cappsie Posted August 3, 2006 Share Posted August 3, 2006 HiI have a page that is contained within a large table.I have been wanting to swtich to php for the convenience of not having to edit lots of pages.Alas it has not proven sucessful - I only want to use very simple php to call in to my main page php pages/docs.For some reason I am having trouble doing this as when I design the main page with the tag:[b]<div class="body"><?php @ require_once ("$page.php"); ?></div>[/b]It only loads half the page - the tutorials I have read haven't made good sense.Is there a step by step guide around here that includes a "rule of thumb" and "best practice" guide?alternatively if someone fancies helping me out it would save me much time - it is only very simple my aim :)I have 6 main page links and within each page are many other links - the main (parent) pages need to be able to list the child links and the child links have to have the ability to 'call' the php info pages into and below those child links.I hope that is clear :-\Anyways thanks in advance:)Adam Quote Link to comment https://forums.phpfreaks.com/topic/16469-php-and-tables/ Share on other sites More sharing options...
hostfreak Posted August 3, 2006 Share Posted August 3, 2006 Try:<?php require_once("page.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/16469-php-and-tables/#findComment-68712 Share on other sites More sharing options...
hostfreak Posted August 3, 2006 Share Posted August 3, 2006 Also have you considered using "include"?<?php include("page.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/16469-php-and-tables/#findComment-68714 Share on other sites More sharing options...
hostfreak Posted August 3, 2006 Share Posted August 3, 2006 Oh and unless the same file is going to be included more than once, you can just use require() Quote Link to comment https://forums.phpfreaks.com/topic/16469-php-and-tables/#findComment-68715 Share on other sites More sharing options...
Ifa Posted August 3, 2006 Share Posted August 3, 2006 it's the $ Quote Link to comment https://forums.phpfreaks.com/topic/16469-php-and-tables/#findComment-68718 Share on other sites More sharing options...
hostfreak Posted August 3, 2006 Share Posted August 3, 2006 Thats what I figured. Quote Link to comment https://forums.phpfreaks.com/topic/16469-php-and-tables/#findComment-68720 Share on other sites More sharing options...
onlyican Posted August 3, 2006 Share Posted August 3, 2006 The main diff between include and require isif an include fails to include, the script continuesif a require fails to include, the script stops Quote Link to comment https://forums.phpfreaks.com/topic/16469-php-and-tables/#findComment-68727 Share on other sites More sharing options...
Ifa Posted August 3, 2006 Share Posted August 3, 2006 Require returns a fatal error, thus halting the script half way. But cose of that @ you don't see the error... Include would just produce a warnig, and let the script run to it's end.I'm slow at typing ;D Quote Link to comment https://forums.phpfreaks.com/topic/16469-php-and-tables/#findComment-68728 Share on other sites More sharing options...
ober Posted August 3, 2006 Share Posted August 3, 2006 I think most of that makes sense.Your require call is a little off however. Try:<div class="body"><?php @require_once ("page.php"); ?></div>If you're including a dynamic page, you can do this: <div class="body"><?php @require_once ($page . ".php"); ?></div> Quote Link to comment https://forums.phpfreaks.com/topic/16469-php-and-tables/#findComment-68743 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.