Problems, need help? Have a tip or advice? Post it here.
15 posts Page 2 of 2
I set the include on the video to :
Code: Select all
<cms:php> include('header.php'); </cms:php> 

it removed the above error, but the navigation that should be printing is completely blank. Here is the php for the navigation I am attempting to include:
Code: Select all
                <div class="container">
               <h1 class="logo">
                  <a href="/">
                     <img alt="" src="/img/logo.png">
                  </a>
               </h1>
               <button class="btn btn-responsive-nav btn-inverse" data-toggle="collapse" data-target=".nav-main-collapse">
                  <i class="icon icon-bars"></i>
               </button>
            </div>
            <div class="navbar-collapse nav-main-collapse collapse">
               <div class="container">
                  <div class="social-icons">
                     <ul class="social-icons">
                        <li class="facebook"><a href="<cms:get_custom_field 'facebook' masterpage='global.php'/>" target="_blank" title="Facebook">Facebook</a></li>
                        <li class="twitter"><a href="<cms:get_custom_field 'twitter' masterpage='global.php'/>" target="_blank" title="Twitter">Twitter</a></li>
                     </ul>
                  </div>
                  <nav class="nav-main mega-menu">
                     <ul class="nav nav-pills nav-main" id="mainMenu">
                        <li <?php if($_SERVER['REQUEST_URI'] == '/index.php' || $_SERVER['REQUEST_URI'] == '/') { echo "class=\"active\""; } ?>>
                           <a href="/" >Home</a>
                        </li>
                        <li <?php if(strstr($_SERVER['REQUEST_URI'], '/about')) { echo "class=\"active\""; } ?>>
                           <a href="/about.php">About Us</a>
                        </li>
                        <li class="dropdown <?php if(strstr($_SERVER['REQUEST_URI'], '/resources')) { echo "active"; } ?>">
                           <a class="dropdown-toggle" href="#">
                              Education Center
                              <i class="icon icon-angle-down"></i>
                           </a>
                           <ul class="dropdown-menu">
                              <li><a href="/resources/videos.php">Videos</a></li>
                              <li><a href="/resources/photos.php">Photo Gallery</a></li>
                              <li><a href="/resources/downloads.php">Free Downloads</a></li>
                              <li><a href="/faq.php">FAQ's</a></li>
                           </ul>
                        </li>

                        <?php /* <li <?php if(strstr($_SERVER['REQUEST_URI'], '/testimonials')) { echo "class=\"active\""; } ?>>
                           <a href="/testimonials.php">Testimonials</a>
                        </li> */ ?>
                        
                        <li <?php if(strstr($_SERVER['REQUEST_URI'], '/ask-a-dr')) { echo "class=\"active\""; } ?>>
                           <a href="/ask-a-dr.php">Ask a Dr.</a>
                        </li>
                        <li <?php if(strstr($_SERVER['REQUEST_URI'], '/contact')) { echo "class=\"active\""; } ?>>
                           <a href="/contact.php">Contact</a>
                        </li>
                        
                     </ul>
                  </nav>
               </div>
            </div>
If you change include('header.php'); to require('header.php');, I think you'll see an error that the file could not be included.
You need to set the right path for the include to succeed.

That said, I think you'll be better off using <cms:embed /> instead of PHP include as you are using Couch tags within 'header.php'.

To do this, move 'header.php' to Couch's snippet folder and use <cms:embed 'header.php' />.

You'll need to change all <?php ?> statements within header.php to <cms:php></cms:php>, as discussed before but now you'll be able to use both Couch as well as PHP tags in the same file.
Funny enough using the require didn't throw an error. I have the header.php file in the includes folder and changed the config file to look there instead of snippets. Now I have switched to using the embed tag, but it seems to break the nav (see screen shot). Any idea what is causing this?

Attachments

Funny enough using the require didn't throw an error.
Yes, I should have known. It was trying to include the file from 'couch' folder and there happens to be a file named 'header.php' there (though not the one you were trying to embed).

The funny characters visible suggest you have messed up converting the <?php tags to <cms:php> tags. Please do a view-source of the generated page and it should provide a clue to the places that would need rectification.
Renamed it to nav and the couch php tags did the trick. Thank you so much KK!
15 posts Page 2 of 2