You are here: Re: put contents of linked file into section of document « All PHP « IT news, forums, messages
Re: put contents of linked file into section of document

Posted by MS on 05/09/06 01:53

What is the purpose/function of inserting the ".php" into the file exists
code?
This is just how my site is set up. There is only one page...but 3 steps to
"index.php"

Step 1) index.php outputs the header.php (require_once "header.php";)

Step 2)
then index.php includes a file dependant upon $pageid
eg. $pageid = "profile"
therefore the profile.php page is included (if it exists)

Step 3)
index.php then outputs the footer (require_once "footer.php";)

Does that mean all called/inserted pages will have to be .php?
pages ending with .php do not need to contain any php code. (they can be
plain html) if they do contain php code... the code will be parsed.

What is the $linkid variable attached to?
$linkid is same as $pageid i just changed the name so you didn't get
confused... lol.. silly me.

$linkid would contain your page names... eg "profile" or "calendar" so that
when clicked it includes the profile.php page or calendar.php page...




"Christina" <designer@centurytel.net> wrote in message
news:HomdnY1Rt63N18LZRVn-iA@centurytel.net...
> Thank you, that makes more sense to me. A couple more questions: What
is
> the purpose/function of inserting the ".php" into the file exists code?
> Does that mean all called/inserted pages will have to be .php? What is
> the $linkid variable attached to? I like to understand each part in order
> to be able to alter if needed.
>
> Thanks again,
>
> Chris
>
> "MS" <nospamplaesegr8t_ukuk@yahoo.co.uk> wrote in message
> news:WKGdndoCFbeU3MLZRVnyhw@bt.com...
> > Your basic index.php would be something like the following.
> >
> > <?php
> > require_once "header.php";
> >
> > // Set Default Page ($pageid)
> > if(!isset($pageid) || !file_exists($pageid.".php")) $pageid= "default";
> >
> >
> > if(file_exists($pageid.".php")){
> > include $pageid.".php";
> > }
> >
> > require_once "footer.php";
> > ?>
> >
> > where pageid can be "words" or "numbers"
> >
> > links are created by ....
> >
> > echo "<a href='?pageid=".$linkid.">Link</a>";
> >
> > --
>
> --------------------------------------------------------------------------
--
> > http://www.myclubweb.co.uk - The Home of Club Websites
>
> --------------------------------------------------------------------------
--
> >
> >
> > "Christina" <designer@centurytel.net> wrote in message
> > news:2KydnQNgXqP7LMPZRVn-rQ@centurytel.net...
> >> Thank you Rene...would the if/else go in the content section?
> >>
> >> I guess I'm not clear on how to generate the linking text into
propogated
> >> menu either. Can you clarify the use of &amp; for me? Is it there to
tell
> >> the browser that it's an html ampersand? Wouldn't it need to use a
> >> variable? (id=$pageid). The links table in the database will have the
> >> pageID, pagename, pagetitle, category, subcategory, etc.
> >>
> >> Thanks again,
> >>
> >> Chris
> >>
> >> "Rene Pot" <renepot@chello.nl> wrote in message
> >> news:1ab9d$445e83e4$3ec2ab98$8322@news.chello.nl...
> >> > If each page has his own ID/name, then you can use the get "script":
> >> >
> >> > <?
> >> > if (isset($_GET['id'])) {
> >> > $id = $_GET['id'];
> >> > } else {
> >> > $id = 0;
> >> > }
> >> > ?>
> >> >
> >> > If you use this code, you need to link to a page like: <a
> >> > href="?page&amp;id=20">Link</a>
> >> > If you want the title to change, just use <title><? echo (&id) ?>
That
> >> > makes the title change into the ID
> >> > The same with link's ;)
> >>
> >>
> >
> >
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация