Hi guys another useful code that i got from a friend ummm its about using ID's as part of the navigation, as in say you wanted to have index.php?id={pagename} (no need for the file extention on the {pagename}) and use one template of your layout in one file while the content pages can be made without great of a fuss as they will fit in your content box so its all handy dandy,
::Code::
<?php
$error = "error.php";
$news = "news/{newsfile}.{extentsion}";
if($id == "") {
include($news); }
if(isset($id)) {
if(file_exists("$id.php")) {
include("$id.php"); }
elseif(file_exists("$id.htm")) {
include("$id.htm"); } else {
include($error); } }
?>
::- Tips
- With the $news and $error you point them to the file where those files are and so if an error is when a page cannot be found the server will look for that file and show that error page,
- Files in folders - With the code it will only look for files not the DIR it lies in so you would put the code in like this in your Browser http://www.{yoursite...withoutfileext}
- Changing the id to suit your site needs, now this was quite a tricky part for me but i figured out how, now as you can see the default is ?id or $id, to change it you can change it to anything you want ,(might not suggest usieng a whole name though) and where you see the id's on the extenstion as in $ip.php (make sure you set the variable above to something like $rv and then replace all the $id's with $rv, if your really clever you can attempt adding another file extension like asp to the list,
:: Linking ::
Now this is another tricky part for those who have trouble with configuring the code to suit your needs, linking is the final stage for your visitors to see that awsome ?rv={pagename} bit on your site, so start off by grabbing your Main file with your layout, and when you add links to pages (within) the site you would code them well i do like this:
<a href="index.php?rv={pagename}">Move your mouse over me to see the ID that we want DONT CLICK you'll bring an error</a> so you would replace {pageame} with the file without the extentsion on the end, if you have done it right, you can try it out and bob is your uncle you now have a page inside your main phpfile (make sure also that incase the url goes as http://www.{yoursite}.com and does not bring up the news then add in your main file and extention like index.php and then add ?rv=newsfolder/newsfile and it will bring it up, some of the time it shouldnt have to worry as you have done it right,
There you go you awsome dudes just another help out for those who need help haha if you have questions please email them to d.dwag.nz@gmail.com and i will try and get back to you asap!
- Revora Forums
- → Viewing Profile: Topics: FlYiNg AcE
FlYiNg AcE
Member Since 18 Dec 2005Offline Last Active Jun 04 2006 04:05 AM
Community Stats
- Group Members
- Active Posts 27
- Profile Views 3,594
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
0
Neutral
User Tools
Topics I've Started
::> Easy PHP Navigation
31 January 2006 - 08:24 PM
My Blog
23 January 2006 - 07:51 PM
Hi all as i said in my intro i have my own blog and yes a hand coded one haha i hate f* myspace haha
Dave's Boring Life
Dave's Boring Life
Ip Display/Log Code :: PHP
19 January 2006 - 12:01 PM
Hay guys i thought this nifty code would help some people with IP Display and Logging them.
Link: http://fundisom.com/...tion/visitor_IP
thanks to the sites linked to as i was looking round for ages just to get it lol
Peace out! Enjoy!
FlYiNg AcE
Link: http://fundisom.com/...tion/visitor_IP
<?php echo $_SERVER['REMOTE_ADDR']; ?>Link: http://www.daniweb.c...hread35565.html
<?php $logfile= 'log.txt'; $IP = $_SERVER['REMOTE_ADDR']; $logdetails= date("F j, Y, g:i a") . ': ' . '<a href=http://dnsstuff.com/tools/city.ch?ip='.$_SERVER['REMOTE_ADDR'].' target=_blank>'.$_SERVER['REMOTE_ADDR'].'</a>'; $fp = fopen($logfile, "a"); fwrite($fp, $logdetails); fwrite($fp, "<br>"); fclose($fp); ?>With the IP Log code ^ you dont have to use the extenstion .txt you can do basically nearly every file extenstion that can show you what's been logged into hte file, as for example you can log ips in a html page, Also i am still working out how to get an ip once only each session when a visitor enters a site and not get it when an visitor goes to another page,
thanks to the sites linked to as i was looking round for ages just to get it lol
Peace out! Enjoy!
FlYiNg AcE
Hi There
19 January 2006 - 11:43 AM
Hi i am Dave aka FlYiNg AcE < internet cafe nickname i use now
ummmm i am 16 from New Zealand and enjoy 3D Animating, Playing Games, Talking to interesting people on msn , ummm i do Martial Arts - Karate (Proactive Martial Arts) ummm what else well there isnt about me to know apart from having a good laugh from time to time, i enjoy sleeping, eating, biking (occasionaly), 3D animatiing , Watching movies, and yeah lol
I have a blog but i aint putting the link here as i dont want to offend the rules here so yeah
Peace out
Dave
ummmm i am 16 from New Zealand and enjoy 3D Animating, Playing Games, Talking to interesting people on msn , ummm i do Martial Arts - Karate (Proactive Martial Arts) ummm what else well there isnt about me to know apart from having a good laugh from time to time, i enjoy sleeping, eating, biking (occasionaly), 3D animatiing , Watching movies, and yeah lol
I have a blog but i aint putting the link here as i dont want to offend the rules here so yeah
Peace out
Dave
Importing Models in Maya 7.0 Unlimited?
27 December 2005 - 09:06 AM
i am just wondering if there is a thing for importing models and actually seeing wat you see in the W3D viewer in Maya as i no longer Use 3DS Max heh this question is out of cuoristy btw
- Revora Forums
- → Viewing Profile: Topics: FlYiNg AcE
- Privacy Policy
- Forum Guidelines ·