Search the Community
Showing results for tags 'php include'.
-
I am using php require to input a page of code. I am including (require) that file several times within the page. I am guessing that it executes the file every time, and does not save any page loading time, and in fact probably slowing it down because it has to make the request every time. Just wanted an expert to confirm or deny my educated guess. Would it be the same if it were including an html file instead of a php file? <?php require ("$base_path/main_page_rotation/content4.php"); ?>
- 1 reply
-
- php require
- php include
-
(and 1 more)
Tagged with:
-
when i dont use the include function the file works as i want only i dont have any functions then, that is why i really need to include my functions file and my register.inc. i have never used include before so please help me i need to get it before tuesday because its for a school assignment. when I do use the include the file only shows his code in the browser. sorry for my english im a dutch student grtz Dario register.php register.inc.php functions.php
-
ok so here is my issue. I have a navigation that is in top-nav.php and i want it the links to show as selected when im on the page for them. I use an if statement and this works for all the top level links. But when im on a page that is a sub menu(drop down item) of one of the main links i want that main link to show as selected.... for instance i have this below.. as you can see the second main link has a sub navigation. each php file has a $current_page = "pageName" in them. But when I do it this way which to me theoretically should work, it always stayed selected no matter what page in on.... for reference... http://a120900.sb1.dev.codeanywhere.net/thwebco/index.php <ul id="nav" class="sf-menu"> <li class="<?php if($current_page == 'home') echo "current-menu-item";?>"><a href="index.php">Home<span class="subheader">Welcome</span></a></li> <li class="<?php if($current_page == 'development' || 'seo' || 'mobile' || 'social' || 'hosting') echo "current-menu-item";?>"><a href="#">Services<span class="subheader">What we offer</span></a> <ul> <li><a href="development.php"><span> Web Design & Development</span></a></li> <li><a href="seo.php"><span> Search Engine Optimization </span></a></li> <li><a href="mobile.php"><span> Mobile </span></a></li> <li><a href="social.php"><span> Social Media </span></a></li> <li><a href="hosting.php"><span> Web Hosting & Email </span></a></li> </ul> </li> <li><a href="#">Our Work <span class="subheader">See our work</span></a> <ul> <li class="<?php if($current_page == 'portfolio') echo "current-menu-item";?>"><a href="portfolio.php"><span>Portfolio </span></a></li> <li class="<?php if($current_page == 'case') echo "current-menu-item";?>"><a href="case.php"><span>Case Studies </span></a></li> </ul> </li> <li class="<?php if($current_page == 'about') echo "current-menu-item";?>"><a href="about.php">About Us<span class="subheader">Who we are</span></a> </li> <li class="<?php if($current_page == 'contact') echo "current-menu-item";?>"><a href="contact.php">Contact<span class="subheader">Get in touch</span></a></li> <li class="<?php if($current_page == 'quote') echo "current-menu-item";?>"><a href="quote.php">Get A Quote<span class="subheader">Let us help</span></a></li> </ul>
-
How can i load a file based on the screen size of my device? <div data-role="page" id="one"> <?php include("header.php") ?> <!-------------------------------- container Start ----------------------------------------> <div class="container"> <div class="containerInner"> <?php include("nav.php") ?> <?php include("banner.php") ?> <?php include("form.php") ?> </div> </div> <!-------------------------------- container End ----------------------------------------> <?php include("footer.php") ?> </div> So instead of <?php include("form.php") ?> I would like to do <?php include("formSMALL.php") ?> I would want any user with a screen width greater than 240px to be presented with form.php and any user with a screen width of 240px or smaller to be presented with formSmall.php I have the below javascript to detect the screen sizes, however im unsure of how to combine the two. Please, any help will be very much appreciated. Heres the javascript I have for screen detection; <!DOCTYPE html> <html> <body> <script type="text/javascript">// <![CDATA[ document.write("Total Width: " + screen.width); document.write("<br/> Total Height: " + screen.height); // ]]></script> script> </body> </html>
- 1 reply
-
- detect screen size
- php include
- (and 2 more)