How to convert an html template to joomla - php

I am new to joomla and trying to change a simple html template to joomla template. I made changes over the templatedetails.xml and index.php. Now my template is visible at templates of joomla. But it is not allowing to add menus or perform any joomla operation over to it.
Here is my index.php file,
<?php
/****************************************************
#####################################################
##-------------------------------------------------##
## TEMP ##
##-------------------------------------------------##
## Copyright = TEMP - 2013 ##
## Date = april 2013 ##
## Author = XYZ ##
## Websites = http://www.google.com ##
## ##
#####################################################
****************************************************/
// no direct access
defined('_JEXEC') or die('Restricted access');
/* The following line loads the MooTools JavaScript Library */
JHtml::_('behavior.framework', true);
/* The following line gets the application object for things like displaying the site name */
$app = JFactory::getApplication();
$csite_name = $app->getCfg('sitename');
$path = $this->baseurl.'/templates/'.$this->template;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<jdoc:include type="head" />
<?php $mod_right = $this->countModules( 'position-7' );
if ( $mod_right ) {
$width = '';
} else {
$width = '-full'; }
?>
<?php
$newsflash = $this->params->get("newsflash", " Content to be added here.. ");
?>
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template.css" type="text/css" />
<script language="javascript" type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template?>/js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template?>/js/superfish.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template?>/js/hoverIntent.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $this->baseurl ?>/templates/<?php echo $this->template?>/js/hide.js"></script>
<script type="text/javascript" src="templates/<?php echo $this->template ?>/js/slideshow.js"></script>
<link rel="icon" type="image/gif" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/favicon.gif" />
<!--[if IE 7]>
<link href="templates/<?php echo $this->template ?>/css/ie7.css" rel="stylesheet" type="text/css" />
<![endif]-->
<script type="text/javascript">
// initialise plugins
jQuery(function(){
jQuery('.navigation ul').superfish();
});
</script>
</head>
<body>
<!-- start header -->
<div id="header">
<div id="logo">
</div>
<div id="menu">
<ul id="main">
<li class="current_page_item">Home</li>
<li>Courses and Admission </li>
<li>Department</li>
<li>Research</li>
<li>Hospital</li>
</ul>
<ul id="feed">
<li>Webmail</li>
<li>Contact us </li>
</ul>
</div>
</div>
<!-- end header -->
<div id="wrapper">
<!-- start page -->
<div id="page">
<div id="sidebar1" class="sidebar">
<ul>
<li>
<h2>Recent Posts</h2>
<marquee scrollamount="3" direction="up" onmouseout="start()" onmouseover="stop();">
<ul>
<li>Aliquam libero</li>
<li>Consectetuer adipiscing elit</li>
<li>Metus aliquam pellentesque</li>
<li>Suspendisse iaculis mauris</li>
<li>Proin gravida orci porttitor</li>
<li>Aliquam libero</li>
<li>Consectetuer adipiscing elit</li>
<li>Metus aliquam pellentesque</li>
<li>Suspendisse iaculis mauris</li>
<li>Proin gravida orci porttitor</li>
</ul>
</marquee>
</li>
<li>
<h2>Recent Comments</h2>
<ul>
<li> Templates on Aliquam libero</li>
<li> Templates on Consectetuer adipiscing elit</li>
<li> Templates on Metus aliquam pellentesque</li>
<li> Templates on Suspendisse iaculis mauris</li>
<li> Templates on Urnanet non molestie semper</li>
<li> Templates on Proin gravida orci porttitor</li>
</ul>
</li>
<li>
<h2>Categories</h2>
<ul>
<li>Aliquam libero</li>
<li>Consectetuer adipiscing elit</li>
<li>Metus aliquam pellentesque</li>
<li>Suspendisse iaculis mauris</li>
<li>Urnanet non molestie semper</li>
<li>Proin gravida orci porttitor</li>
</ul>
</li>
<li>
<h2>Archives</h2>
<ul>
<li>September (23)</li>
<li>August (31)</li>
<li>July (31)</li>
<li>June (30)</li>
<li>May (31)</li>
</ul>
</li>
</ul>
</div>
<!-- start content -->
<div id="content">
<div class="flower">
<img src="templates/<?php echo $this->template ?>/images/img06.jpg" width="510" height="250" alt="logotype" /></div>
<div class="post">
<h1 class="title">Welcome to TEMP !</h1>
<div class="entry">
<p>
<strong>TEMP </strong> is one of the SIX TEMP like apex healthcare institutes being established by the Ministry of Health & Family Welfare, Government of India under the Pradhan Mantri Swasthya Suraksha Yojna (PMSSY). With the aim of correcting regional imbalances in quality tertiary level healthcare in the country, and attaining self sufficiency in graduate and postgraduate medical education and training the PMSSY planned to set up 6 new TEMP like institutions in under served areas of the country.</p>
<p>These institutions are being established by an Act of Parliament on the lines of the original All India Institute of Medical Sciences in New Delhi which imparts both undergraduate and postgraduate medical education in all its branches and related fields, along with nursing and paramedical training. to bring together in one place educational facilities of the highest order for the training of personnel in all branches of health care activity. </p>
<p> </p>
<p class="links">«« Read More »»</p>
</div>
</div>
<div class="post">
<h2 class="title">Sample Tags</h2>
<div class="entry">
<h3>An H3 Followed by a Blockquote:</h3>
<blockquote>
<p>“Donec leo, vivamus nibh in augue at urna congue rutrum. Quisque dictum integer nisl risus, sagittis convallis, rutrum id, congue, and nibh.”</p>
</blockquote>
<h3>Bulleted List:</h3>
<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Phasellus nec erat sit amet nibh pellentesque congue.</li>
<li>Cras vitae metus aliquam risus pellentesque pharetra.</li>
</ul>
<h3>Numbered List:</h3>
<ol>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Phasellus nec erat sit amet nibh pellentesque congue.</li>
<li>Cras vitae metus aliquam risus pellentesque pharetra.</li>
</ol>
<p class="links">«« Read More »»</p>
</div>
</div>
<!-- end content -->
<!-- start sidebars -->
<div id="sidebar2" class="sidebar">
<ul>
<li>
<form id="searchform" method="get" action="#">
<div>
<h2>Site Search</h2>
<input type="text" name="s" id="s" size="15" value="" />
</div>
</form>
</li>
<li>
<h2>Tags</h2>
<p class="tag">dolor ipsum lorem sit amet dolor ipsum lorem sit amet</p></li>
<li>
<h2>Calendar</h2>
<div id="calendar_wrap">
<table summary="Calendar">
<caption>
October 2009
</caption>
<thead>
<tr>
<th abbr="Monday" scope="col" title="Monday">M</th>
<th abbr="Tuesday" scope="col" title="Tuesday">T</th>
<th abbr="Wednesday" scope="col" title="Wednesday">W</th>
<th abbr="Thursday" scope="col" title="Thursday">T</th>
<th abbr="Friday" scope="col" title="Friday">F</th>
<th abbr="Saturday" scope="col" title="Saturday">S</th>
<th abbr="Sunday" scope="col" title="Sunday">S</th>
</tr>
</thead>
<tfoot>
<tr>
<td abbr="September" colspan="3" id="prev">« Sep</td>
<td class="pad"> </td>
<td colspan="3" id="next"> </td>
</tr>
</tfoot>
<tbody>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td id="today">4</td>
<td>5</td>
<td>6</td>
<td>7</td>
</tr>
<tr>
<td>8</td>
<td>9</td>
<td>10</td>
<td>11</td>
<td>12</td>
<td>13</td>
<td>14</td>
</tr>
<tr>
<td>15</td>
<td>16</td>
<td>17</td>
<td>18</td>
<td>19</td>
<td>20</td>
<td>21</td>
</tr>
<tr>
<td>22</td>
<td>23</td>
<td>24</td>
<td>25</td>
<td>26</td>
<td>27</td>
<td>28</td>
</tr>
<tr>
<td>29</td>
<td>30</td>
<td>31</td>
<td class="pad" colspan="4"> </td>
</tr>
</tbody>
</table>
</div>
</li>
<li>
<h2>Categories</h2>
<ul>
<li>Aliquam libero</li>
<li>Consectetuer adipiscing elit</li>
<li>Metus aliquam pellentesque</li>
<li>Suspendisse iaculis mauris</li>
<li>Urnanet non molestie semper</li>
<li>Proin gravida orci porttitor</li>
<li>Aliquam libero</li>
<li>Consectetuer adipiscing elit</li>
<li>Metus aliquam pellentesque</li>
<li>Urnanet non molestie semper</li>
<li>Proin gravida orci porttitor</li>
<li>Aliquam libero</li>
<li>Consectetuer adipiscing elit</li>
<li>Metus aliquam pellentesque</li>
<li>Suspendisse iaculis mauris</li>
<li>Urnanet non molestie semper</li>
<li>Proin gravida orci porttitor</li>
<li>Metus aliquam pellentesque</li>
<li>Suspendisse iaculis mauris</li>
<li>Urnanet non molestie semper</li>
<li>Proin gravida orci porttitor</li>
<li>Metus aliquam pellentesque</li>
</ul>
</li>
</ul>
</div>
<!-- end sidebars -->
<div style="clear: both;"> </div>
</div>
<!-- end page -->
</div>
<div id="footer">
<p class="copyright">© 2009 All Rights Reserved • Design by TEMP IT Dept..</p>
<p class="link">Privacy Policy • Terms of Use</p>
</div>
</html>
Please suggest how i can change this html template to exact joomla template. Thanks.

Replace conrete content with references to module positions, message container and component output. Your template will then look like
<?php
/**
* My template
*
* #copyright (C)2013 Neetesh <neetesh#example.com>
* #author XYZ
* #link http://www.google.com
*/
// No direct access
defined('_JEXEC') or die('Restricted access');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<jdoc:include type="head" />
<link rel="stylesheet" href="<?php echo $this->baseurl ?>/templates/<?php echo $this->template ?>/css/template.css" type="text/css" />
<link rel="icon" type="image/gif" href="<?php echo $this->baseurl; ?>/templates/<?php echo $this->template; ?>/favicon.gif" />
<!--[if IE 7]>
<link href="templates/<?php echo $this->template ?>/css/ie7.css" rel="stylesheet" type="text/css" />
<![endif]-->
</head>
<body>
<!-- start header -->
<div id="header">
<div id="logo">
<jdoc:include type="modules" name="logo" />
</div>
<div id="menu">
<jdoc:include type="modules" name="header" />
</div>
</div>
<div id="wrapper">
<div id="page">
<div id="sidebar1" class="sidebar">
<jdoc:include type="modules" name="left" />
</div>
<div id="content">
<jdoc:include type="message" />
<jdoc:include type="component" />
</div>
<div id="sidebar2" class="sidebar">
<jdoc:include type="modules" name="right" />
</div>
<div style="clear: both;"> </div>
</div>
</div>
<div id="footer">
<jdoc:include type="modules" name="footer" />
</div>
</html>
The example above provides the module positions logo, header, left, right, and footer. Add these to the templateDetails.xml.
Next, find modules producing the sudebar content, you want, and assign them to the position, where you want to see them.

Related

The main html in Wordpress front-page is not displaying, how can i fix it?

The html inside the main tag is not displaying but when I inspect the code, the html is there. This happens after I added the get_header function which gets a new header that is only for the front-page (other pages will get the normal header). The header and the footer are displaying without issues, only some listed items in the hero section aren't displaying either. I'm new to Wordpress and PHP, what is the best way to fix this?
My header-new.php code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>Title</title>
<meta content="" name="description">
<meta content="" name="keywords">
<!-- Favicons -->
<link href="assets/img/favicon.png" rel="icon">
<link href="assets/img/apple-touch-icon.png" rel="apple-touch-icon">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Montserrat:300,300i,400,400i,500,500i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">
<?php wp_head();?>
</head>
<body>
<!-- ======= Hero Section ======= -->
<section id="hero">
<div class="hero-container">
<img src ="<?php bloginfo('template_directory');?>/assets/img/light-logo.png" alt="Logo" class="img-fluid hero-logo" data-aos="zoom-in">
<ul data-aos="fade-up">
<li>Listed Item 1</li>
<li>Listed Item 2</li>
<li>Listed Item 3</li>
<li>Listed Item 4</li>
</ul>
<a data-aos="fade-up" href="#about" class="btn-get-started scrollto">Learn More</a>
</div>
</section><!-- End Hero -->
<!-- ======= Header ======= -->
<header id="header" class="d-flex align-items-center">
<div id="navbar-container">
<div class="logo d-block d-lg-none">
<img src="<?php bloginfo('template_directory');?>/assets/img/dark-logo.png" alt="Maite Richert Logo" class="img-fluid">
</div>
<nav class="nav-menu d-none d-lg-block">
<ul class="nav-inner">
<li class="active">Meet Me</li>
<li class="drop-down">Programs
<ul>
<li>One-to-one Coaching</li>
<li>Posing Lessons</li>
</ul>
</li>
<li class="nav-logo"><img src="<?php bloginfo('template_directory');?>/assets/img/dark-logo.png" alt="Logo" class="img-fluid logo-image"></li>
<li>Shop</li>
<li>Contact</li>
</ul>
</nav><!-- .nav-menu -->
</div>
</header><!-- End Header -->
<main id="main">
My footer.php code:
</main><!-- End #main -->
<!-- ======= Footer ======= -->
<footer id="footer">
<div class="footer-top">
<div class="container">
<div class="social-links">
<img src="<?php bloginfo('template_directory');?>/assets/img/tiktok.png" alt="TikTok Icon" class="tiktok">
<i class="bx bxl-instagram"></i>
<i class='bx bxl-youtube'></i></i>
</div>
</div>
</div>
<div class="container footer-bottom clearfix">
<div class="copyright">
© <strong><span>Maite Richert</span></strong>. All Rights Reserved. 2020
</div>
</div>
</footer><!-- End Footer -->
<i class="icofont-simple-up"></i>
<?php wp_footer();?>
</body>
</html>
And my front-page.php code:
<!-- ======= About Us Section ======= -->
<section id="about" class="about">
<div class="container">
<div class="section-title" data-aos="fade-up">
<h2>Meet Me</h2>
</div>
<div class="row">
<div class="col-lg-6" data-aos="fade-right">
<div class="image">
<img src="<?php bloginfo('template_directory');?>/assets/img/maite.jpg" class="img-fluid" alt="Fitness Coach">
</div>
</div>
<div class="col-lg-6" data-aos="fade-left">
<div class="content pt-4 pt-lg-0 pl-0 pl-lg-3 ">
<h3>Hi, I'm Maite</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
<ul>
<li><i class="bx bx-check"></i> Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li><i class="bx bx-check"></i> Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li><i class="bx bx-check"></i> Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li><i class="bx bx-check"></i> Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
<li><i class="bx bx-check"></i> Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
</ul>
</div>
</div>
</div>
</div>
</section><!-- End About Us Section -->
<!-- ======= Services Section ======= -->
<section id="services" class="services">
<div class="container">
<div class="section-title" data-aos="fade-up">
<h2>Programs</h2>
</div>
<div class="row" style="margin-bottom: 10vh;">
<div class="col-lg-6 order-2 order-lg-1 services-box">
<div class="icon-box mt-5 mt-lg-0" data-aos="fade-up">
<i class="icofont-muscle-weight"></i>
<h4>One-to-one coaching</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<div class="learn-more-btn">Learn More</div>
</div>
<div class="icon-box mt-5" data-aos="fade-up" data-aos-delay="100">
<i class="icofont-trophy"></i>
<h4>Posing Coach</h4>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
<div class="learn-more-btn">Learn More</div>
</div>
</div>
<div class="col-lg-6 order-1 order-lg-2" data-aos="fade-left" data-aos-delay="100"><img class="img-fluid" src="<?php bloginfo('template_directory');?>/assets/img/services.jpg" alt="Fitnees posing"></div>
</div>
</div>
</section><!-- End Services Section -->
<!-- ======= Why Us Section ======= -->
<section id="why-us" class="why-us">
<div class="container">
<div class="row">
<div class="col-lg-12 order-2 order-lg-1 d-flex flex-column justify-content-center align-items-stretch">
<div class="content" data-aos="fade-up">
<h3><b>Why should you choose me?</b></h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
<h4>How can you help you?</h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
<h4>Will this work for you?</h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
<h4>Aren't all the personal trainers the same?</h4>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
</div>
</div>
</section><!-- End Why Us Section -->
<!-- ======= Sponsors Section ======= -->
<section id="sponsors" class="sponsors">
<div class="container">
<h3>Sponsors</h3>
<div class="row sponsor-img-container">
<div class="col-lg-2 col-md-4 col-6" data-aos="zoom-in" data-aos-delay="400">
<img src="<?php bloginfo('template_directory');?>/assets/img/sponsors/sponsor-5-1.png" id="womens-best" class="img-fluid" alt="Women's Best">
</div>
<div class="col-lg-2 col-md-4 col-6" data-aos="zoom-in" data-aos-delay="500">
<img src="<?php bloginfo('template_directory');?>/assets/img/sponsors/sponsor-6.png" class="img-fluid" alt="Ryderwear">
</div>
<div class="col-lg-2 col-md-4 col-6" data-aos="zoom-in" data-aos-delay="300">
<img src="<?php bloginfo('template_directory');?>/assets/img/sponsors/sponsor-4-1.png" id="wbff" class="img-fluid" alt="WBFF">
</div>
<div class="col-lg-2 col-md-4 col-6" data-aos="zoom-in" data-aos-delay="100">
<img src="<?php bloginfo('template_directory');?>/assets/img/sponsors/sponsor-2.png" class="img-fluid" alt="FitGriff">
</div>
<div class="col-lg-2 col-md-4 col-6" data-aos="zoom-in" data-aos-delay="200">
<img src="<?php bloginfo('template_directory');?>/assets/img/sponsors/sponsor-3-1.png" id="f4" class="img-fluid" alt="Factory 4">
</div>
<div class="col-lg-2 col-md-4 col-6" data-aos="zoom-in">
<img src="<?php bloginfo('template_directory');?>/assets/img/sponsors/sponsor-1.png" class="img-fluid" alt="Basic Fit">
</div>
</div>
</div>
</section><!-- End Sponsors Section -->
<!-- ======= Contact Section ======= -->
<section id="contact" class="contact section-bg">
<div class="container">
<div class="section-title">
<h2>Contact</h2>
<p>If you are interested in my services or if you have any questions, don't hesitate to contact me!</p>
</div>
<div class="row">
<div class="col-lg-8 mt-5 mt-lg-0 form-box">
<form action="forms/contact.php" method="post" role="form" class="php-email-form" data-aos="fade-left">
<div class="form-row">
<div class="col-md-6 form-group">
<input type="text" name="name" class="form-control" id="name" placeholder="Your Name" data-rule="minlen:4" data-msg="Please enter at least 4 chars" />
<div class="validate"></div>
<p>So I can get to know you better.</p>
</div>
<div class="col-md-6 form-group">
<input type="email" class="form-control" name="email" id="email" placeholder="Your Email" data-rule="email" data-msg="Please enter a valid email" />
<div class="validate"></div>
<p>Only to reply you back. No marketing.</p>
</div>
</div>
<div class="form-group" style="padding-bottom: 2rem;">
<input type="text" class="form-control" name="subject" id="subject" placeholder="Subject" data-rule="minlen:4" data-msg="Please enter at least 8 chars of subject" />
<div class="validate"></div>
</div>
<div class="form-group">
<textarea class="form-control" name="message" rows="5" data-rule="required" data-msg="Please write something for us" placeholder="Message"></textarea>
<div class="validate"></div>
</div>
<div class="mb-3">
<div class="loading">Loading</div>
<div class="error-message"></div>
<div class="sent-message">Your message has been sent. Thank you!</div>
</div>
<div class="text-center form-btn-container"><button type="submit">Send Message</button></div>
</form>
</div>
</div>
</div>
</section><!-- End Contact Section -->
<?php get_footer();?>
This is not a direct answer to your question, but it may solve your problem, so I hope the answer is helpful for you.
If you only want to add a hero section to your front page, I think you do not need a page template and header template only for this one case. You could add a if clause inside of your default header.php checking if you are on frontpage. If it is true, your hero section is being inserted:
<body>
<?php if (is_front_page()) { ?>
<!-- ======= Hero Section ======= -->
<section id="hero">
<div class="hero-container">
<img src ="<?php bloginfo('template_directory');?>/assets/img/light-logo.png" alt="Logo" class="img-fluid hero-logo" data-aos="zoom-in">
<ul data-aos="fade-up">
<li>Listed Item 1</li>
<li>Listed Item 2</li>
<li>Listed Item 3</li>
<li>Listed Item 4</li>
</ul>
<a data-aos="fade-up" href="#about" class="btn-get-started scrollto">Learn More</a>
</div>
</section><!-- End Hero -->
<?php } ?>
.
.
.
This would be my solution. Does it work for you? If not, try chaning the content of your hero-container to check if something is wrong with this code. Just add a <p>test</p> to see that the if clause is working and that only the frontpage is outputting the paragraph with "test".
If you want to have a different page template (maybe because there are more pages you want to show the hero section), make sure you use the right file names to make wordpress template hierarchy work: https://developer.wordpress.org/themes/basics/template-hierarchy/
Page Template can be created with copying the page.php, renaming it page-frontpage.php and adding /* Template Name: Frontpage */ at the top of it. Go to your wordpress backend and edit your frontpage. On the right side under "page attributes" select the created page template.
Inside of your page-frontpage.php change the get_header() function to:
get_header('frontpage');
Then create a copy of your header.php and name it "header-frontpage.php".
Now every page that has the "frontpage" page template, will use the header with the name "frontpage". In the header-frontpage.php you make your changes.
For me a template only makes sense, if it is applied to more pages. For one case, you can do more easy and faster using an if clause.
Hope this can help you.

How to render more than one dynamic sections / includes / yields in master template using laravel 5.4.6

i am new to laravel and working on my first project in laravel 5.4.6. I have a problem that is how to render multiple dynamic sections / include / yield content into master template. I have already used #section('content') but need more sections( which have dynamic data from database) to show on my layout page. Below is my problem details:
1- Route
Route::group(['middleware' => ['web']], function () {
Route::get('/', 'HomeController#showIndex');
Route::get('/index', 'HomeController#showIndex');});
2- master.blade.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>#yield('title')-Al Quraish Publications</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="Author" content="" />
<link href="favicon.png" rel="icon" type="image/png">
<meta name="viewport" content="width=device-width, maximum-scale=1, initial-scale=1, user-scalable=0" />
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700,800" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/plugins/bootstrap/css/bootstrap.min.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/css/font-awesome.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/plugins/owl-carousel/owl.carousel.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/plugins/owl-carousel/owl.theme.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/plugins/owl-carousel/owl.transitions.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/plugins/magnific-popup/magnific-popup.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/css/animate.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/css/superslides.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/plugins/revolution-slider/css/settings.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/css/essentials.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/css/layout.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/css/slider.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/css/layout-responsive.css')}}" rel="stylesheet" type="text/css" />
<link href="{{asset('assets/css/color_scheme/brown.css')}}" rel="stylesheet" type="text/css" /><!-- orange: default style -->
<link href="{{asset('assets/css/color_scheme/brown.css')}}" rel="alternate stylesheet" type="text/css" title="brown" />
<script type="text/javascript" src="assets/plugins/modernizr.min.js"></script>
<link href="assets/css/jquery.bxslider.css" rel="stylesheet">
</head>
<body>
<div class="top-header">
<div class="container">
<div class="row">
<div class="col-sm-6">
<div class="topleft">
<ul class="socials-icons">
<li><a href="https://web.facebook.com/AlQuraishPublishers?_rdr" target="_blank">
<i class="fa fa-facebook"></i> Facebook</a></li>
#if(\Auth::check())
<li>
<i class="fa fa-user"></i> Dashboard
</li>
#else
<li>
<i class="fa fa-user"></i> Log In
</li>
#endif
</ul>
</div>
</div>
<div class="col-sm-6">
<div class="topright">
<i class="fa fa-phone"></i> 92 42 37668958 , 37652546 , 37361439
<i class="fa fa-envelope-o"></i> <a class="wht" href="mailto:info#alquraish.com">info#alquraish.com</a>
</div>
</div>
</div>
</div>
</div>
<!-- TOP NAV -->
<div class="pos-absolute">
<header id="topNav" style="height: 100px !important;"><!--data-spy="affix" data-offset-top="100" -->
<div class="container">
<!-- Top Header -->
<div class="clearfix"></div>
<!-- Mobile Menu Button -->
<button class="btn btn-mobile" data-toggle="collapse" data-target=".nav-main-collapse">
<i class="fa fa-bars"></i>
</button>
<!-- Logo text or image -->
<!-- Logo text or image -->
<a class="logo" href="index.html">
<img src="assets/images/logo.png">
</a>
<!-- Top Nav -->
<div class="navbar-collapse nav-main-collapse collapse pull-right">
<nav class="nav-main mega-menu">
<ul class="nav nav-pills nav-main scroll-menu" id="topMain">
<li>Home</li>
<li>About Us</li>
<li>Books</li>
<li>Order Now</li>
<li>Contact Us</li>
</ul>
</nav>
</div>
<!-- /Top Nav -->
</div>
</header>
</div>
<!-- WRAPPER -->
<div id="wrapper" >
<!-- REVOLUTION SLIDER -->
<div class="fullwidthbanner-container roundedcorners pos-reletive">
<div class="fullwidthbanner">
<ul>
<li data-transition="curtain-2" data-slotamount="5" data-masterspeed="700">
<img src="assets/images/sliders/1.jpg" alt="" data-bgfit="cover" data-bgposition="left top" data-bgrepeat="no-repeat">
</li>
<li data-transition="curtain-2" data-slotamount="5" data-masterspeed="700">
<img src="assets/images/sliders/2.jpg" alt="" data-bgfit="cover" data-bgposition="left top" data-bgrepeat="no-repeat">
</li>
<li data-transition="3dcurtain-vertical" ddata-slotamount="15" data-masterspeed="300" data-delay="9400">
<img src="assets/images/sliders/3.jpg" alt="" data-bgfit="cover" data-bgposition="left top" data-bgrepeat="no-repeat">
</li>
<li data-transition="3dcurtain-vertical" ddata-slotamount="15" data-masterspeed="300" data-delay="9400">
<img src="assets/images/sliders/4.jpg" alt="" data-bgfit="cover" data-bgposition="left top" data-bgrepeat="no-repeat">
</li>
<li data-transition="3dcurtain-vertical" ddata-slotamount="15" data-masterspeed="300" data-delay="9400">
<img src="assets/images/sliders/5.jpg" alt="" data-bgfit="cover" data-bgposition="left top" data-bgrepeat="no-repeat">
</li>
<li data-transition="3dcurtain-vertical" ddata-slotamount="15" data-masterspeed="300" data-delay="9400">
<img src="assets/images/sliders/6.jpg" alt="" data-bgfit="cover" data-bgposition="left top" data-bgrepeat="no-repeat">
</li>
</ul>
<div class="tp-bannertimer"></div>
</div>
</div>
<!-- /REVOLUTION SLIDER -->
#section('content')
#show
<div class="container">
<div class="row">
<div class="scroll-img">
<div id="clients-flexslider" class="flexslider home clients">
<div class="slider1">
<div class="slide">
<img src="assets/images/gallery-scroll/1.png">
<p>Nazia Kanwal Nazi</p>
</div>
<div class="slide">
<img src="assets/images/gallery-scroll/2.png">
<p>Riaz Aqab</p>
</div>
<div class="slide">
<img src="assets/images/gallery-scroll/3.png">
<p>Rizq Shah</p>
</div>
<div class="slide">
<img src="assets/images/gallery-scroll/4.png">
<p>Malik Safdar Hayat</p>
</div>
<div class="slide">
<img src="assets/images/gallery-scroll/5.png">
<p>Mehwish Iftikhar</p>
</div>
<div class="slide">
<img src="assets/images/gallery-scroll/6.png">
<p>Fakhira Gull</p>
</div>
<div class="slide">
<img src="assets/images/gallery-scroll/7.png">
<p>Asia Mirza</p>
</div>
<div class="slide">
<img src="assets/images/gallery-scroll/8.png">
<p>Mirza Amjad Baig</p>
</div>
<div class="slide">
<img src="assets/images/gallery-scroll/9.png">
<p>Anwar Ulaiqi</p>
</div>
<div class="slide">
<img src="assets/images/gallery-scroll/10.png">
<p>Iffat Tahir</p>
</div>
<div class="slide">
<img src="assets/images/gallery-scroll/11.png">
<p>MA Rahat</p>
</div>
</div>
</div>
</div> <!--scroll-img ends-->
=> here is i have problem becuase this setion has data from database and giving me the error of " Undefined variable: "
**<div class="col-md-12">
#include('layouts.homeWelcomeHeading')
</div>**
</div> <!--row ends-->
</div>
</div>
<!-- /WRAPPER -->
<div class="container">
<div class="row padding60">
<!-- FORM -->
<div class="col-md-6">
<iframe src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2FAlQuraishPublishers%2F&tabs=timeline&width=800&height=500&small_header=false&adapt_container_width=true&hide_cover=false&show_facepile=true&appId" width="800" height="500" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true"></iframe>
</div>
<div class="col-md-6">
<h3>Message Board</h3>
<h4>Publisher, Books & Magazine Distribution Book Store</h4>
<p>Order your favorite Book / Novel And Get 35% Discount...
For Online Order message Us
Book will be delivered to your door step
Free Home Delivery all across Pakistan </p>
<form class="white-row" action="#" method="post">
<div class="row">
<div class="form-group">
<div class="col-md-6">
<label>Full Name *</label>
<input type="text" value="" data-msg-required="Please enter your name." maxlength="100" class="form-control" name="name" id="name">
</div>
<div class="col-md-6">
<label>E-mail *</label>
<input type="email" value="" data-msg-required="Please enter your email address." data-msg-email="Please enter a valid email address." maxlength="100" class="form-control" name="email" id="email">
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-6">
<label>Phone / Mobile *</label>
<input type="text" value="" data-msg-required="Please enter your name." maxlength="100" class="form-control" name="name" id="name">
</div>
<div class="col-md-6">
<label>Subject *</label>
<input type="email" value="" data-msg-required="Please enter your email address." data-msg-email="Please enter a valid email address." maxlength="100" class="form-control" name="email" id="email">
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-12">
<label>Message *</label>
<textarea maxlength="5000" data-msg-required="Please enter your message." rows="10" class="form-control" name="message" id="message"></textarea>
</div>
</div>
</div>
<br />
<div class="row">
<div class="col-md-12">
<input type="submit" value="Submit Message" class="btn btn-primary btn-lg" data-loading-text="Loading...">
</div>
</div>
</form>
</div>
</div>
</div>
<section class="cover margin-footer parallax" data-stellar-background-ratio="0.7" style="background-image: url('assets/images/parallax_bg.jpg');">
<div class="container">
<h3 align="center">Our customers have said</h3>
<div class="owl-carousel text-center" data-plugin-options='{"items": 1, "singleItem": true, "navigation": true, "pagination": false, "autoPlay": true, "transitionStyle":"fadeUp"}'><!-- transitionStyle: fade, backSlide, goDown, fadeUp, -->
<div class="testimonial">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.</p>
<cite><strong>Writer Name</strong>, Customer</cite>
</div>
<div class="testimonial">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.</p>
<cite><strong>Writer Name</strong>, Customer</cite>
</div>
<div class="testimonial">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.</p>
<cite><strong>Writer Name</strong>, Customer</cite>
</div>
<div class="testimonial">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.</p>
<cite><strong>Writer Name</strong>, Customer</cite>
</div>
</div>
</div>
</section>
<!-- FOOTER -->
<footer>
<div class="clearfix"></div>
<!-- footer content -->
<div class="footer-content">
<div class="container">
<div class="row">
<!-- FOOTER CONTACT INFO -->
<div class="column col-md-8">
<h3>Title</h3>
<p class="contact-desc">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</p>
<p class="contact-desc">
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</div>
<!-- /FOOTER CONTACT INFO -->
<!-- FOOTER Profile -->
<div class="column col-md-4">
<h3>Get In Touch</h3>
<address class="font-opensans">
<ul>
<li class="footer-sprite address">
text will be here
</li>
<li class="footer-sprite phone">
<strong>Landline:</strong> +1234567789<br>
</li>
<li class="footer-sprite email">
info#mail.com<br>
</li>
</ul>
</address>
</div>
<!-- /FOOTER Profile -->
</div>
</div>
</div>
<!-- footer content -->
<!-- copyright , scrollTo Top -->
<div class="footer-bar">
<div class="container">
<span class="copyright">Copyright © All Rights Reserved.
<span style="display:inline-block; text-align: right; float: right; "> ||
Powered by: <small>Me</small></span>
</span>
<a class="toTop" href="#topNav">Go To Top <i class="fa fa-arrow-circle-up"></i></a>
</div>
</div>
<!-- copyright , scrollTo Top -->
</footer>
<!-- /FOOTER -->
<script type="text/javascript" src="assets/plugins/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="assets/plugins/jquery.cookie.js"></script>
<script type="text/javascript" src="assets/plugins/jquery.appear.js"></script>
<script type="text/javascript" src="assets/plugins/jquery.isotope.js"></script>
<script type="text/javascript" src="assets/plugins/masonry.js"></script>
<script src="assets/js/jquery.bxslider.js"></script>
<script src="assets/js/jquery.bxslider.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.slider1').bxSlider({
auto: true,
autoControls: true,
slideWidth: 155,
minSlides: 2,
maxSlides: 7,
slideMargin: 10,
pager: true,
moveSlides: 2,
/*'auto': true,
'autoControls': true,
'pager':false,
'pager':false,
'infiniteLoop':false,
'minSlides':1,
'maxSlides': 3,
'slideWidth': '210px',
'slideMargin':5*/
});
$('#slider2').bxSlider({
'auto': true,
'autoControls': true,
'adaptiveHeight': true,
/*mode: 'vertical',*/
});
});
</script>
<script type="text/javascript" src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/plugins/magnific-popup/jquery.magnific-popup.min.js"></script>
<script type="text/javascript" src="assets/plugins/owl-carousel/owl.carousel.min.js"></script>
<script type="text/javascript" src="assets/plugins/stellar/jquery.stellar.min.js"></script>
<script type="text/javascript" src="assets/plugins/knob/js/jquery.knob.js"></script>
<script type="text/javascript" src="assets/plugins/jquery.backstretch.min.js"></script>
<script type="text/javascript" src="assets/plugins/superslides/dist/jquery.superslides.min.js"></script>
<script type="text/javascript" src="assets/plugins/mediaelement/build/mediaelement-and-player.min.js"></script>
<script type="text/javascript" src="assets/plugins/revolution-slider/js/jquery.themepunch.tools.min.js"></script>
<script type="text/javascript" src="assets/plugins/revolution-slider/js/jquery.themepunch.revolution.min.js"></script>
<script type="text/javascript" src="assets/js/slider_revolution.js"></script>
<script type="text/javascript" src="assets/js/scripts.js"></script>
</body>
</html>
3- Controller
public function showIndex()
{
//$text = DB::table('content')->get();
$text = Content::all();
return view('index', ['ok', $text]);
}
Please help me in this problem i am stuck.
As far as I understand from your question if you need multiple dynamic section to be inserted into master, you need multiple yeilds like
#yield('content')
#yield('dynamin-1')
#yield('dynamic-2')
.......
.......
then in another blade file you need to extend the master and insert the sections like
#extends('layouts.master')
#section('content')
bla bla <strong>bla bla bla....</strong>
#endsection
#section('dynamin-1')
bla bla <strong>bla bla bla....</strong>
#endsection
#section('dynamin-2')
bla bla <strong>bla bla bla....</strong>
#endsection
....
so in your case you do not need the #section('content') in you master unless you put it consciously! whenever you will put #section('content') in a extended view this section in master will be overridden!
Dear i think you are using
#section() // instead of yield()
make sure you use
#yield('content')
#yield('section1')
#yield('section2')
in master.blade php
in child pages you can do it like this
#extends('layouts.master')
#section('content')
#endsection
#section('section1')
#endsection
#section('section2')
#endsection

Show a pages code including require statements

I am trying to display the code of a php file as plain html. This is all going well except for that fact that I would like it to 'open up' the <?php require 'Main_content_bar.php'; ?> statements aswell.
So far I have show_source($page); correctly working.
It currently prints:
<?php require 'Main_content_bar.php'; ?>
<!-- Jumbotron -->
<div class="jumbotron">
<h1>Property</h1>
<p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus
commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet.</p>
</div>
<div class="row">
<div class="col-md-12">
<h2>Current properties</h2>
</div>
</div>
<div class="footer">
<p><a href="Source_code.php" target="_blank"> <img src="Images/codebutton<?php echo $page_lower;?>.jpg" alt="<?php echo $page;?> Source"> </img>
</a></p>
<p>© Robin B'stards Retail 2014</p>
</div>
</body>
</html>
However, as one can see, the contents of the require statements do not show. I cannot for the life of me work out how to do this.
So what it would end up looking like is something like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="jquery-2.1.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<!-- <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.2/css/bootstrapValidator.min.css"/>-->
<!-- <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.2/js/bootstrapValidator.min.js"></script>-->
<link href="justified-nav.css" rel="stylesheet">
<script>
$(function(){
var url = window.location.href;
var page = url.substr(url.lastIndexOf('/')+1);
$('.nav a[href*="'+page+'"]').parent().addClass('active');
});
</script>
</head>
<body>
<div class="container" style="width: 1263px">
<div class="masthead">
<h3 class="text-muted">Ruthless Real Estate</h3>
<ul class="nav nav-justified">
<li class="menu">Property</li>
<li class="menu">Client</li>
<li class="menu">Type</li>
<li class="menu">Feature</li>
<li class="menu">Multiple Properties</li>
<li class="menu">Property Features</li>
<li class="menu">Images</li>
</ul>
</div>
<!-- Jumbotron -->
<div class="jumbotron">
<h1>Property</h1>
<p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Fusce dapibus, tellus ac cursus
commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet.</p>
</div>
<div class="row">
<div class="col-md-12">
<h2>Current properties</h2>
</div>
</div>
<div class="footer">
<p><a href="Source_code.php" target="_blank"> <img src="Images/codebutton<?php echo $page_lower;?>.jpg" alt="<?php echo $page;?> Source"> </img>
</a></p>
<p>© Robin B'stards Retail 2014</p>
</div>
</body>
</html>
Note the lack of require statements
You cannot do that with show_source, which just "show some code sources" of a file.
You need to create your own function which take a filename in argument, then you have to analyze the source like this:
replace all require/include/require_once/include_once (what do I forget?) by their own content
make the function recursive (because Main_content_bar.php can have other include inside it)
Use highlight_string at the end of your function.
EDIT to search & replace, one way (there is several) is to use preg_match_all. That part of the code would look like this :
$new_content = file_get_contents('your-file.php');
$base_path = __DIR__.'/';
// pattern to find require, require_once, include, include_once functions
// and catch their arguments
$pattern = "#<\?php (?:require|include(?:_once)?)\s*'(.*)'; \?>#u";
if (preg_match_all($pattern, $new_content, $matches))
{
foreach($matches[0] as $pattern_index => $full_pattern)
{
$file = $matches[1][$pattern_index];
$subcontent = file_get_contents($base_path.$matches[$pattern_index]);
$new_content = str_replace($new_content, $full_pattern, $subcontent);
}
}
highlight_string($new_content);

Issue with multiple forms

I have two forms on my page. One is in the footer which I cannot change. The second is in my main page. Confused? I hope not.
When I open the style-demo page (link below) you can see that the information belonging in the Footer form is partially entered into the comment form on the page.
The Form in the footer works correctly however the comment section does not.
Any help to have both work would be greatly appreciated.
Thank you.
Here are my links
http://richardtamm.com/includes/footer.php
http://richardtamm.com/style-demo.php
Here is the code
Footer
<div class="wrapper">
<div id="footer" class="clear">
<div class="fl_left">
<div id="about_us" class="border">
<h2>About R. Tamm</h2>
<p>Richard Tamm is an avid photographer and writer. Richard was born in the state of Michigan and currently lives in the state of Indiana. He is married with 4 wonderful children who love to call him daddy. </p>
<p>When not writing or taking photographs Richard enjoys watching movies and spending quality time with his family.</p>
</div>
<div id="contact" class="clear">
<h2>Contact Us</h2>
<div class="fl_left">
<form name="contactform" method="post" action="send_form_email.php">
<label for="first_name">First Name:</label>
<input type="text" name="first_name" id="first_name" value="">
<label for="last_name">Last Name:</label>
<input type="text" name="last_name" id="last_name" value="">
<label for="email">Email:</label>
<input type="text" name="email" id="email" value="">
<label for="comments">Message:</label>
<textarea name="comments" id="comments" cols="45" rows="10"></textarea>
<button type="submit" value="submit"><span>Submit</span></button>
</form>
</div>
<div class="fl_right">
<address>
<strong class="title">Company Name</strong><br>
Richard Tamm<br>
EYE-TO-IMAGE<br>
Jasonville, Indiana<br>
47438
</address>
<ul>
<!--<li><strong class="title">Tel:</strong><br>
xxxxx xxxxxxxxxx</li>
<li><strong class="title">Fax:</strong><br>
xxxxx xxxxxxxxxx</li>-->
<li><strong class="title">Email:</strong><br>
<?php echo $emailaddress; ?></li>
</ul>
</div>
</div>
</div>
<!-- ####################################################################################################### -->
<div class="fl_right">
<div id="tabcontainer" class="border">
<ul id="tabnav">
<li>From The Blog</li>
<li>Latest Tweets</li>
<li class="last">Link Share</li>
</ul>
<div id="tabs-1" class="tabcontainer">
<script src="layout/scripts/blogfeed.setup.js"></script>
<script src="http://widget.feed.mikle.com/js/rssmikle.js"></script>
<div style="font-size:10px; text-align:right;">RSS widget</div>
</div>
<!-- ########### -->
<div id="tabs-2" class="tabcontainer">
<a class="twitter-timeline" href="https://twitter.com/rltamm" data-widget-id="435882309061865472">Tweets by #rltamm</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div>
<!-- ########### -->
<div id="tabs-3" class="tabcontainer">
<ul>
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
</ul>
</div>
</div>
<h2>Keep Up To Date</h2>
<ul class="socialize">
<li><span>Facebook:</span> www.facebook.com/rltamm</li>
<li class="last"><span>Twitter:</span> www.twitter.com/rltamm</li>
</ul>
</div>
</div>
<div id="backtotop">To The Top <span class="icon-arrow-up"></span></div>
</div>
<!-- ####################################################################################################### -->
<div class="wrapper">
<div id="copyright" class="clear">
<p class="fl_left">Copyright © 2011 - 2014 All Rights Reserved - <?php echo $sitename; ?></p>
<p class="fl_right">Website by <?php echo $sitename; ?> & <a target="_blank" href="http://www.os-templates.com/" title="Free Website Templates">OS Templates</a></p>
</div>
</div>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
<script src="layout/scripts/jquery.defaultvalue.js"></script>
<script src="layout/scripts/jquery.scrollTo-min.js"></script>
<script>
$(document).ready(function () {
$("#first_name, #last_name, #email, #comments").defaultvalue("First Name", "Last Name", "Email", "Message");
$('a.topOfPage').click(function () {
$.scrollTo(0, 1200);
return false;
});
$("#tabcontainer").tabs({
event: "click"
});
});
</script>
<script src="layout/scripts/jquery-prettyPhoto.js"></script>
<script src="layout/scripts/jquery-prettyPhoto-setup.js"></script>
Main Page
<?php
$titletag = 'Bookshelf - Page 1';
$metdescr = 'This is the SEO description - not too long not to short used in Google search results';
include_once($_SERVER["DOCUMENT_ROOT"].'/includes/header.php');
?>
<!-- ####################################################################################################### -->
<div class="wrapper col4">
<div id="container" class="clear">
<!-- ####################################################################################################### -->
<?php include_once($_SERVER["DOCUMENT_ROOT"].'/includes/shout.php'); ?>
<!-- ####################################################################################################### -->
<!-- ####################################################################################################### -->
<div id="content">
<h1><h1> to <h6> - Headline Colour and Size Are All The Same</h1>
<img class="imgr" src="images/demo/imgr.gif" alt="" width="125" height="125" />
<p>Aliquatjusto quisque nam consequat doloreet vest orna partur scetur portortis nam. Metadipiscing eget facilis elit sagittis felisi eger id justo maurisus convallicitur.</p>
<p>Dapiensociis temper donec auctortortis cumsan et curabitur condis lorem loborttis leo. Ipsumcommodo libero nunc at in velis tincidunt pellentum tincidunt vel lorem.</p>
<img class="imgl" src="images/demo/imgl.gif" alt="" width="125" height="125" />
<p>This is a W3C compliant free website template from OS Templates. This template is distributed using a Website Template Licence.</p>
<p>You can use and modify the template for both personal and commercial use. You must keep all copyright information and credit links in the template and associated files. For more CSS templates visit Free Website Templates.</p>
<p>Portortornec condimenterdum eget consectetuer condis consequam pretium pellus sed mauris enim. Puruselit mauris nulla hendimentesque elit semper nam a sapien urna sempus.</p>
<h2>Table(s)</h2>
<table summary="Summary Here" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
<th>Header 4</th>
</tr>
</thead>
<tbody>
<tr class="light">
<td>Value 1</td>
<td>Value 2</td>
<td>Value 3</td>
<td>Value 4</td>
</tr>
<tr class="dark">
<td>Value 5</td>
<td>Value 6</td>
<td>Value 7</td>
<td>Value 8</td>
</tr>
<tr class="light">
<td>Value 9</td>
<td>Value 10</td>
<td>Value 11</td>
<td>Value 12</td>
</tr>
<tr class="dark">
<td>Value 13</td>
<td>Value 14</td>
<td>Value 15</td>
<td>Value 16</td>
</tr>
</tbody>
</table>
<div id="comments">
<h2>Comments</h2>
<ul class="commentlist">
<li class="comment_odd">
<div class="author"><img class="avatar" src="images/demo/avatar.gif" width="32" height="32" alt="" /><span class="name">A Name</span> <span class="wrote">wrote:</span></div>
<div class="submitdate">August 4, 2009 at 8:35 am</div>
<p>This is an example of a comment made on a post. You can either edit the comment, delete the comment or reply to the comment. Use this as a place to respond to the post or to share what you are thinking.</p>
</li>
<li class="comment_even">
<div class="author"><img class="avatar" src="images/demo/avatar.gif" width="32" height="32" alt="" /><span class="name">A Name</span> <span class="wrote">wrote:</span></div>
<div class="submitdate">August 4, 2009 at 8:35 am</div>
<p>This is an example of a comment made on a post. You can either edit the comment, delete the comment or reply to the comment. Use this as a place to respond to the post or to share what you are thinking.</p>
</li>
<li class="comment_odd">
<div class="author"><img class="avatar" src="images/demo/avatar.gif" width="32" height="32" alt="" /><span class="name">A Name</span> <span class="wrote">wrote:</span></div>
<div class="submitdate">August 4, 2009 at 8:35 am</div>
<p>This is an example of a comment made on a post. You can either edit the comment, delete the comment or reply to the comment. Use this as a place to respond to the post or to share what you are thinking.</p>
</li>
</ul>
</div>
<h2>Write A Comment</h2>
<div id="respond">
<form action="#" method="post">
<p>
<input type="text" name="name" id="name" value="" size="22" />
<label for="name"><small>Name (required)</small></label>
</p>
<p>
<input type="text" name="email" id="email" value="" size="22" />
<label for="email"><small>Mail (required)</small></label>
</p>
<p>
<textarea name="comment" id="comment" cols="100%" rows="10"></textarea>
<label for="comment" style="display:none;"><small>Comment (required)</small></label>
</p>
<p>
<input name="submit" type="submit" id="submit" value="Submit Form" />
<input name="reset" type="reset" id="reset" tabindex="5" value="Reset Form" />
</p>
</form>
</div>
</div>
<div id="column">
<div class="subnav">
<h2>Secondary Navigation</h2>
<ul>
<li>Open Source Templates</li>
<li>Free CSS Templates
<ul>
<li>Free XHTML Templates</li>
<li>Free Website Templates</li>
</ul>
</li>
<li>Open Source Layouts
<ul>
<li>Open Source Software</li>
<li>Open Source Webdesign
<ul>
<li>Open Source Downloads</li>
<li>Open Source Website</li>
</ul>
</li>
</ul>
</li>
<li>Open Source Themes</li>
</ul>
</div>
<div class="holder">
<h2 class="title"><img src="images/demo/60x60.gif" alt="" />Nullamlacus dui ipsum conseque</h2>
<p>Nullamlacus dui ipsum conseque loborttis non euisque morbi penas dapibulum orna. Urnaultrices quis curabitur phasellentesque.</p>
<p class="readmore">Continue Reading »</p>
</div>
<div id="featured">
<ul>
<li>
<h2>Indonectetus facilis</h2>
<p class="imgholder"><img src="images/demo/240x90.gif" alt="" /></p>
<p>Nullamlacus dui ipsum conseque loborttis non euisque morbi penas dapibulum orna. Urnaultrices quis curabitur phasellentesque congue magnis vestibulum quismodo nulla et feugiat. Adipisciniapellentum leo ut consequam ris felit elit id nibh sociis malesuada.</p>
<p class="readmore">Continue Reading »</p>
</li>
</ul>
</div>
<div class="holder">
<h2>Lorem ipsum dolor</h2>
<p>Nuncsed sed conseque a at quismodo tris mauristibus sed habiturpiscinia sed.</p>
<ul>
<li>Lorem ipsum dolor sit</li>
<li>Etiam vel sapien et</li>
<li>Etiam vel sapien et</li>
</ul>
<p>Nuncsed sed conseque a at quismodo tris mauristibus sed habiturpiscinia sed. Condimentumsantincidunt dui mattis magna intesque purus orci augue lor nibh.</p>
<p class="readmore">Continue Reading »</p>
</div>
</div>
<!-- ####################################################################################################### -->
<div class="clear"></div>
</div>
</div>
<!-- ####################################################################################################### -->
<?php include_once($_SERVER["DOCUMENT_ROOT"].'/includes/footer.php'); ?>
</body>
</html>
In the main page, the form is defined as <form action="#" method="post">. For the action, you need to put the PHP file you're calling. # doesn't make sense. Look at your other declaration:
<form name="contactform" method="post" action="send_form_email.php">
This makes sense. It's telling HTML to send to send_form_email.php the information through POST.

Problem loading php page via shadowbox

Hy I have a html page in witch I want to open a php page via shadowbox, the problem is in IE 6/7/8 the page is loading but it is not displaing, it works perfectly in FF
this is the hole page, the problem occures when you click on contact#termo-gaz-instal.ro at the bottom of the page. I have tried using colorbox and thickbox
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7">
<title>Untitled Document</title>
<link rel="stylesheet", href="style.css" type="text/css" charset="utf-8">
<link rel="stylesheet", href="shadowbox-3.0.3/shadowbox.css" type="text/css" charset="utf-8">
<link rel="stylesheet", href="colorbox/example1/colorbox.css" type="text/css" charset="utf-8">
<script type='text/javascript' src="js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="colorbox/colorbox/jquery.colorbox.js"></script>
<script type="text/javascript" src="js/moving-boxes.js"></script>
<script type='text/javascript' src="shadowbox-3.0.3/shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init();
</script>
<script type="text/javascript">
$(document).ready(function(){
$(".example7").colorbox({width:"80%", height:"80%", iframe:true});
});
</script>
</head>
<body>
<div id="wraper">
<div id="logo">
<img class="poza" src="images/logo.png" alt="Logo" width="311" height="106">
<h1>TERMO GAZ INSTAL</h1>
</div><!--logo -->
<div id="spacer"></div>
<div id="container">
<div id="slider">
<img class="scrollButtons left" src="images/leftarrow.png">
<div style="overflow: hidden;" class="scroll">
<div class="scrollContainer">
<div class="panel" id="panel_1">
<div class="inside">
<img src="images/1.jpg" alt="picture" />
<h2>News Heading</h2>
<p>A very shot exerpt goes here... more link</p>
</div>
</div>
<div class="panel" id="panel_2">
<div class="inside">
<img src="images/2.jpg" alt="picture" />
<h2>News Heading</h2>
<p>A very shot exerpt goes here... more link</p>
</div>
</div>
<div class="panel" id="panel_3">
<div class="inside">
<img src="images/3.jpg" alt="picture" />
<h2>News Heading</h2>
<p>A very shot exerpt goes here... more link</p>
</div>
</div>
<div class="panel" id="panel_4">
<div class="inside">
<img src="images/4.jpg" alt="picture" />
<h2>News Heading</h2>
<p>A very shot exerpt goes here... more link</p>
</div>
</div>
<div class="panel" id="panel_5">
<div class="inside">
<img src="images/5.jpg" alt="picture" />
<h2>News Heading</h2>
<p>A very shot exerpt goes here... more link</p>
</div>
</div>
</div>
<div id="left-shadow"></div>
<div id="right-shadow"></div>
</div>
<img class="scrollButtons right" src="images/rightarrow.png">
</div>
</div><!--container -->
<div id="spacer"></div>
<div id="important_txt">
<span class="important_txt">Sistemele</span> de instalatii ultraperformante ce sunt sustinute de un <span class="important_txt">design</span> bine gandit si de un <span class="important_txt">management</span> performant.<br>
Instalatiile de <span class="important_txt">gaz, apa si canalizare</span> sunt o parte <span class="important_txt">importanta</span> a vietii noastre indiferent de circumstantele in care ne aflam. <span class="important_txt">Executia</span> acestor lucrari este <span class="important_txt">importanta</span> deoarece de ea depinde <span class="important_txt">siguranta</span> si <span class="important_txt">bunastarea</span> noastra.
</div><!--important -->
<div id="imag">
<div class="stg">
<img class="imag" src="images/imag_06.png" width="222" height="222" alt="apa">
<div id="txt">
<span class="stg_s">INSTALATII DE APA<br> CALDA SI RECE</span><br>
<span class="stg_j">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ultricies nulla massa. Suspendisse venenatis euismod adipiscing. Donec urna mauris, hendrerit. <span style="color:#FFF; font-size:11px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; text-decoration:underline;">Mai mult</span> </span>
<div id="read" style="display:none;">
<div id="content" style="padding:20px;color:white;">
<p>1This content was taken from a hidden div in this page!</p>
</div>
</div>
</div><!--txt -->
</div><!--stg -->
<div class="stg1">
<img class="imag" src="images/imag_08.png" width="222" height="222" alt="gaz">
<div id="txt">
<span class="stg_s">INSTALATII DE GAZ</span><br><br>
<span class="stg_j1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ultricies nulla massa. Suspendisse venenatis euismod adipiscing. Donec urna mauris, hendrerit.<span style="color:#FFF; font-size:11px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; text-decoration:underline;">Mai mult</span> </span>
<div id="read2" style="display:none;">
<div id="content" style="padding:20px;color:white;">
<p>12This content was taken from a hidden div in this page!</p>
</div>
</div>
</div><!--txt -->
</div><!--stg1 -->
<div class="stg1">
<img class="imag" src="images/imag_10.png" width="222" height="222" alt="gaz">
<div id="txt">
<span class="stg_s">INSTALATII DE DEJECTIE</span><br><br>
<span class="stg_j1">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ultricies nulla massa. Suspendisse venenatis euismod adipiscing. Donec urna mauris, hendrerit. <span style="color:#FFF; font-size:11px; font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; text-decoration:underline;">Mai mult</span></span>
<div id="read3" style="display:none;">
<div id="content" style="padding:20px;color:white;">
<p>123This content was taken from a hidden div in this page!</p>
</div>
</div>
</div><!--txt -->
</div><!--stg -->
<div id="clear"></div>
</div><!--imag -->
</div><!--wraper --><br><br>
<div id="footer">
<div id="wraper">
<div id="footer_stg">
<p class="tel_cont">TELEFON DE CONTACT</p>
<img class="bula" src="images/bula.png" width="76" height="75" alt="Text Bubble"><br>
<span class="telefon">+40 021<span class="telefon1"> 201 35 55</span></span>
</div><!--footer_stg -->
<div id="footer_dr">
<a rel="shadowbox" href="http://www.google.com" ><p class="contact">CONTACT</p></a>
contact#termo-gaz-instal.ro</p>
</div><!--footer_dr -->
<div id="clear"></div>
<br>
<div id="spacer1"></div>
<p style="font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:18px; color:#545454; float:left;">termo-gaz-instal.ro © toate drepturile rezervate</p><p style="font-family:'Trebuchet MS', Arial, Helvetica, sans-serif; font-size:18px; color:#545454; float:right; text-align:right">design|Ionescu Ionut<p>
</div><!--wraper -->
</div><!--footer -->
</body>
</html>
Thx for you time and help
P.S. Sorry for the earlier question
......................
This is for Michael
<?php
$erori = '';
$nr_erori = 0;
$mesaj_trimis = "nu";
if (isset($_POST['submit'])){
$name_field = $_POST['nume'] ;
$telephone_field = $_POST['telefon'] ;
$email_field = $_POST['email'] ;
$message = $_POST['mesaj'] ;
if ($name_field == '') { $erori .= 'Campul "Nume" este obligatoriu.<br>'; $nr_erori++; }
if ($telephone_field == '') { $erori .= 'Campul "Telefon" este obligatoriu.<br>'; $nr_erori++; }
if ($message == '') { $erori .= 'Campul "Mesaj" este obligatoriu.<br>'; $nr_erori++; }
if ($nr_erori == 0) {
$body = "De la: ".$name_field."</br> Telefon: ".$telephone_field."</br> </br> E-Mail: ".$email_field."</br> </br> Mesaj:</br> ".$message;
$sender = "ere#ere.ro";
$catre = "ere1#ere.ro";
// BEGIN SWIFT CLASS
require("swiftmail/Swift.php");
require("swiftmail/Swift/Connection/SMTP.php");
$smtp=new Swift_Connection_SMTP("localhost");
$smtp->setUsername("ere#ere.ro");
$smtp->setPassword("xxxx");
$swift =& new Swift($smtp);
$message =& new Swift_Message("Mesaj de la formularul de contact al site-ului");
$message->attach(new Swift_Message_Part($body, "text/html"));
if ($swift->send($message, $catre, new Swift_Address($sender, "Office Site"))) {
$mesaj_trimis = "da";
}
// END SWIFT CLASS
}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Contact</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container2">
<div class="cont">
<table width="495" height="475" border="0">
<tr>
<td width="278"><?php if ($nr_erori > 0) { echo '<div>'.$erori.'</div>'; } if ($mesaj_trimis == "da") { echo "<div>Mesajul dumneavoastra a fost trimis. Va multumim ! </div>"; } else { ?> <form id="form1" name="form1" method="post" action=""> <input type="hidden" name="submit" value="1" /> <table width="278" height="362" border="0"> <tr> <td width="150">*Nume</td> <td width="340"><label> <input type="text" name="nume" id="nume" /> </label></td> </tr> <tr> <td>*Telefon</td> <td><label> <input type="text" name="telefon" id="telefon" /> </label></td> </tr> <tr> <td>E-mail</td> <td><label> <input type="text" name="email" id="email" /> </label></td> </tr> <tr> <td>*Mesajul Dumneavoastra</td> <td><label> <textarea name="mesaj" id="mesaj" cols="16" rows="10"></textarea> </label></td> </tr>
<tr>
<td colspan="2">! Campurile marcate cu * sunt OBLIGATORI</td>
</tr>
<tr> <td> </td> <td><label> <input type="submit" name="submit_bt" id="submit_bt" value="Trimite" /> </label></td> </tr> </table> </form>
<p>
<?php } ?>
<br />
</p>
<p> </p>
<td width="207" height="471"><table width="203" height="383" border="0">
<tr>
<td height="379" valign="top"><p>Ambulanta Veterinara Mina Vet S.R.L.<br />
<br />
Str. Constantin Nottara, Nr.2, Sector 3 , Bucuresti </p>
<table width="201" height="103" border="0">
<tr>
<td>Telefon:</td>
<td>0726.223.374</td>
</tr>
<tr>
<td height="23"> </td>
<td>0725.533.502</td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>Fax:</td>
<td>0372.872.427</td>
</tr>
<tr>
<td height="23">E-mail</td>
<td>contact#minavet.ro</td>
</tr>
</table>
<p></p></td>
</tr>
</table>
</table></div>
<div class="google">
<iframe width="400" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Strada+Constantin+C.+Nottara,+Bucharest,+Romania&sll=44.420111,26.133664&sspn=0.006774,0.01929&ie=UTF8&hq=&hnear=Strada+Constantin+C.+Nottara,+Romania&ll=44.424708,26.136389&spn=0.021454,0.034332&z=14&iwloc=A&output=embed"></iframe><br /><small>View Larger Map</small>
</div>
</div>
</body>
</html>
For starters it might help if the $(".example7").colorbox() matched the class of the contact link. Just a guess, though.
If you don't want to debug this yourself, try stan-js (that IE7 behaviour compatibility thing).
there seems to have some misinterpretation of CSS in IE.
Try to set a white background in contact.php, it did the trick for some file of mine.
Hope this helps ;)

Categories