thablkpanda
Aug 16 2005, 11:42 PM
| | There are alot of sites out there with the index.php as the main page right? (Namely all of them) However when some coders create sites, they create separate entitites and pages with a ?page=4 modifier, or whatever page they want it to be.
I don't know how to do that, because each page is 'based' off of the index.php page, when I find an example, i'll post it here, but Does anyone know how to do this?
Panda
Like I said, this is hard to explain, so when I get an example, I"ll post it here.
Panda |
Reply
palladin
Aug 17 2005, 12:04 AM
it's easy: First you must get this variable: CODE <?php if ( isset($HTTP_GET_VARS['page'])) { $ID = strval($HTTP_GET_VARS['page']); } ?>
Next you can use this $ID to chose what page load. In the simple way, using "if, else if" CODE <?php if ($ID == 1) { include("some_page.php"); } else if ($ID == 2) { include("some_page2.php"); } else { include("bad_page.php");
} ?>
There is many others way to use this kind variables, from content whole page to content one ceil in table  -------------------- Practice is when evrything work but no one know why. Theory is when work nothing but evry one know why. Programmers join Practice with Theory - nothing work and no one know why 
Reply
biscuitrat
Aug 17 2005, 12:05 AM
Omgz I love you both - Panda for asking the question, and you palladin for answering it. I've been looking for that for ages to paginate my stories so I don't run into page after page of documents.
Reply
truefusion
Aug 17 2005, 01:44 AM
Here's a way using arrays: CODE <?
$page = $_GET['page'];
$i = array( 1 => 'page1.html', 2 => 'page2.html', 3 => 'page3.html' );
if (isset($page)){ include($i["$page"]); }
?>
This looks more organized to me. Works the same as palladin's way.
Reply
rvovk
Aug 17 2005, 02:40 AM
CODE <? $val = $_GET['id']; // Replace id with whatever you want to use, eg ?id=page $val .= ".php"; // Makes the filename complete so if you called ?id=index, it would be index.php it has to look for $dirty = array(".."); $clean = array(""); $val = str_replace($dirty, $clean, $val); // Prevent people from viewing root files like your password (should work i just quikly added it without testing)
if (isset($_GET['id'])) { // Replace id with whatever you want to use, eg ?id=page if (file_exists($val)) { // This checks if the file you are trying to call exists include "$val"; } else { include "404.php"; // If the file doesnt exists it calls your 404 error page } } else { include "news.php"; // If ?id= is not set it will now go to your news page }
// Include this script in your content area // Run ?id=pagename (without .php) to view a page ?>
Reply
leiaah
Aug 17 2005, 05:58 AM
CODE ?page=something So I guess this is what they call a query string?! I've been trying to figure this one out as well. Palladin: I'm guessing ID is a variable that you can easily change the value of? Can I use a link for this one e.g. if I want to do ID=2 can I just do this (see code below)? [CODE]<a href="?ID=2">switch to new page</a>
Reply
palladin
Aug 17 2005, 09:28 AM
Yea but i make small mistake  Better write what evry line do for future use. CODE <a href="?ID=2">switch to new page</a> | HTML | this is call index.php?ID=2 CODE if ( isset($HTTP_GET_VARS['ID']) == TRUE) { CODE } | PHP | this is check is variable ID are use as argument in page adress CODE $ID = intval($HTTP_GET_VARS['ID']); | PHP | this assign value from HTTP variables (using in adress) to $ID php integer variable for future use. (ID=1) CODE $ID = strval($HTTP_GET_VARS['ID']); | PHP | this assign value from HTTP variables (using in adress) to $ID php string variable for future use. (ID=news) thats all  you can use rvovk example too: Using check only is variable are called: http://page.com/index.php?newsCODE if ( isset($HTTP_GET_VARS['news']) == TRUE) { include("news.php")} http://page.com/index.php?musicCODE if ( isset($HTTP_GET_VARS['music']) == TRUE) { include("music.php")} -------------------- Practice is when evrything work but no one know why. Theory is when work nothing but evry one know why. Programmers join Practice with Theory - nothing work and no one know why
Reply
HmmZ
Aug 17 2005, 06:18 PM
There are many ways to achieve such urls, i personally love them but havent completely figured out the much tougher function based php I will show you a function i use for News, the authorization that is..: CODE Function AuthAddNews() { Global $user,$uid, $admin, $aid, $db; if((!isset($admin)) || (!isset($user))){ Header("Location: index.php"); die(); } $db->"SELECT * FROM ".$prefix."_permission where userid="".$uid." OR adminid="".$aid.""; $result = query(); $permission = mysql_fetch_rows($result); if($permission[p_admin]=!1){ if($permission[p_user]=!1){ $permission = false; $id = "anonymous"; } } else { If(isset($admin)){ $id = $aid; } if(isset($user)){ $id = $uid; } else { die(); } $permission = true; } Header("Location: index.php?act=news&permission=".$permission."&id=".$id.""); }
It's quite simple, first on the frontpage i had a link called News and the link was: index.php?act=newsyou just write it. this should open the news() function (wich should obviously have been written) Once in the news function you write your code (for example "view_news","add_news","edit_news") etcetera.. those will each get their link or redirect to their function, easily done by once you want it to get kicked in, you write: CODE view_news(); and it will open/include the view_news function, when you do it that way, your url will change: CODE index.php?act=view_news
in view_news you can do the same, but, if you have permissions set (guests cant see news for example) you dont have to do it with opening the function within[b] a function, you just redirect it with the necessary (or unnecessary) tools:
CODE index.php?act=view_news&permission=".$permission." wich, if its a guest who cant view, will change the url once in the page (and with necessary text to show the visitor it may not see it):
CODE index.php?act=view_news&permission=false
in the example i used, the permission is checked (wich will be used in the next function) together with the user or admin id (wich will also be needed in the next function), wich gives, for example if its user number 1100:
CODE index.php?act=news&permission=true&id=1100
in your next function you can write down the code for a false permission and a true permission.
Now, that's not all, at the end of your page, you need to add the following to get for example the [b]act=news: CODE //first we get the act, wich you can make anything you want! switch($_REQUEST[act]){ //next we need to set a default, wich could be the "front_page" function default: front_page(); break; //in our example we only make 1 switch..to the news...wich has multiple switches... //so there are actually several switches, but not all have to be made here, since //they are within the function, these codes are purely for the thing AFTER act= //for example...act=news ... the rest behind it is WITHIN the function case: news(); break; }
I hope this made a little sense.. its alot of code and dont want to go through it again >.> just hoping it helps a bit, we all start from the beginning, im a tiny bit further wich gives me the privilige to be able to help others..right?
Reply
leiaah
Aug 21 2005, 10:35 AM
QUOTE(palladin @ Aug 17 2005, 05:28 PM) Yea but i make small mistake  Better write what evry line do for future use. <a href="?ID=2">switch to new page</a> | HTML | this is call index.php?ID=2 if ( isset($HTTP_GET_VARS['ID']) == TRUE) { CODE } | PHP | this is check is variable ID are use as argument in page adress $ID = intval($HTTP_GET_VARS['ID']); | PHP | this assign value from HTTP variables (using in adress) to $ID php integer variable for future use. (ID=1) $ID = strval($HTTP_GET_VARS['ID']); | PHP | this assign value from HTTP variables (using in adress) to $ID php string variable for future use. (ID=news) thats all  you can use rvovk example too: Using check only is variable are called: http://page.com/index.php?newsif ( isset($HTTP_GET_VARS['news']) == TRUE) { include("news.php")} http://page.com/index.php?musicif ( isset($HTTP_GET_VARS['music']) == TRUE) { include("music.php")} -------------------- Practice is when evrything work but no one know why. Theory is when work nothing but evry one know why. Programmers join Practice with Theory - nothing work and no one know why  Hi..do I have to make the ID variable into a SESSIon or a COOKIE variable in this case? thanks.
Reply
palladin
Aug 22 2005, 07:26 AM
For cookies: setcookie(cookieid as string, cookie value, expiration date); example: CODE <?php setcookie("USER", "GUEST", time()+3600) ?>
expiration date are counting in seconds so call php time() function give you actual time + 3600 seconds (1 hour) after this time cookie was deleted. setcookie mmust be called before html HEAD section was end; for get cookie just call CODE <?php $user = $_COOKIE("USER"); ?>
evrywhere you wanna  -- Session was little more complex: here a link for php help :] http://php.net/session-------------------- Practice is when evrything work but no one know why. Theory is when work nothing but evry one know why. Programmers join Practice with Theory - nothing work and no one know why
Reply
michaelper22
Feb 5 2006, 07:05 PM
QUOTE(thablkpanda @ Aug 16 2005, 06:42 PM)  There are alot of sites out there with the index.php as the main page right? (Namely all of them) However when some coders create sites, they create separate entitites and pages with a ?page=4 modifier, or whatever page they want it to be.
I don't know how to do that, because each page is 'based' off of the index.php page, when I find an example, i'll post it here, but Does anyone know how to do this? Panda
Like I said, this is hard to explain, so when I get an example, I"ll post it here.
Panda
Most of the time, when you see something like that, it means that the page is part of a dynamic site. It's usually run off of some CMS (Mambo, Joomla, or someother one). For example: CODE http://roslyn.busstop.trap17.com/mambo/index.php?option=com_content&task=view&id=15&Itemid=26 is what Mambo produces, and this: CODE http://busstop.trap17.com/blog/index.php?p=28 is what WordPress puts out. Hope this clarifies things for you.
Reply
Recent Queries:--
page.com/index.php?page= - 474.48 hr back. (2)
Similar Topics
Keywords : php, single, page, w, index, php, page, 4, stuff, read, cuz, hard, explain
- My First Website
Where can i find useful web page templates? (3)
Trap17 Registration Page Linkage Errors
(2) Hello all, I am a new member to the forums, and hope I can be of service to you all. As I came
across this hosting service I noticed a couple links on this page:
http://www.trap17.com/forums/free-web-host...ation-t106.html The broken link is located in 2
places where the "--> Register" link is under both here, REMEMBER :: No one is going to snatch
away your account. So take your time, Relax and then post at the forums. Don't post in a hurry
to simply get an Account. You will get it at any cost, provided you make GOOD posts. Get it in a
good way. You are expe....
Ntfs Or Fat For My Stuff?
(3) I'm dual-booting Windows and Ubuntu. My HD has 3 partitions, one for each operating system and
the third partition for my stuff. The Windows partition is formatted as NTFS, and the Ubuntu
partition is formatted as ext2. I formatted the third partition as FAT32 because when I first set
up this system, Ubuntu couldn't read from/write to NTFS partitions easily. But now that Ubuntu
can supposedly handle NTFS, should I move all my stuff off the HD, reformat the third partition as
NTFS, and put everything back on? Would this have any huge advantage over having my stu....
Welcome All New Registered Users Of Trap17
Please read as soon as you join. (0) Hello. Trap17 welcomes all of you great new members to our fabulous community of Free webhosting
with No Ads ! /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif"
/> First thing you need to do when you have registered, is make your Introduction in the
Introductions forum so we can all meet, and get to know you. /smile.gif"
style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> Next you have to post a bit
till you get 10, or 30 hosting credits. Once you have the required posts (They must be non-spammed
quality posts. N....
How To Have More Than 1 Ipod In A Single Computer?
It describes about connecting many ipods in a single computer (1) Hi guys. Lets say you have 3 ipods. Lets name them 1,2 and 3. If 1 is connected and you are working
in iTunes, and now now when u connect iPod 2 , all the songs in ipod 2 will be erased and updated
with the songs in the library of ipod 1. to avoid this, just have more than 1 account (in XP) and in
each account u should connect ony one ipod. ....
Mac To Read Microsoft Word
(3) What software do I have to install for a Mac operating system to be able to read the Microsoft word
and excel files?....
I Can't Find The Password Reset Page... [resolved]
(5) I can't find the password reset page (I know it costs credits to request) Can anyone give me
the link please to that page, it has other options too if i remember. Thanks....
Cant Log Into Cpanel [resolved]
Page cant be displayed (11) Help I can not log into cpanel. I just upgraded to IE-7 and now I can not get into my Cpanel. what
the page is telling me is this. QUOTE Internet Explorer cannot display the webpage Most
likely causes: You are not connected to the Internet. The website is encountering problems. There
might be a typing error in the address. What you can try: Diagnose Connection Problems
More information This problem can be caused by a variety of issues, including: Internet
connectivity has been lost. The website is temporarily unavailable. The D....
That Its Hard To Make It Team
(1) I want to tell to everyone who want to make IT team is very dificult if each member has another
priority. maybe in first discussion all will say "ok, i want participate" or "i'm in" or
anything word that its have mean he/she want join in team. But after everything will set up to
forwards, and someone in team got lost, teamwork will fall to piece. one by one get other priority
and team got to frazzle. I tell to all, if you want make a team. make sure what the point you build
a team. and each member must have responsibility to his/her work in team. and if someone in y....
My Ro Page
(4) I designed my own website and code it xD this website is for my server JevilRO www.jevilro.com....
Plot Page Help Invisionfree
(0) I've made a few boards with invisionfree before, but I have no idea of what a plot page is or
how to make one. can someone help me out?....
Page Load Error When Trying To Get Into Control Panel
I just changed domain (2) I had put a domain name that I didn't have when I registered my website. I got the 15 credits
and changed it to a subdomain. Now I can't log into my control panel. At first it was telling me
I had the wrong password which I'm sure I don't. Now I just get a timed out error. Also my
confirmation email for changing my domain was kinda blank. QUOTE Hi, This mail is to notify
you that your domain has been changed to : Regards, trap17.com So yeah... any help? EDIT:
Also I don't see my request to change domain the proper forum I had attempte....
PHP Function To Add Previous and Next Page Feature
useful php function (5) CODE <?php function navigationbar($start_number = 0, $items_per_page = 50,
$count) { // Creates a navigation bar $current_page =
$_SERVER["PHP_SELF"]; if (($start_number < 0) ||
(! is_numeric($start_number))) { $start_number = 0; }
$navbar = ""; $prev_navbar = ""; $next_navbar =
""; if ($count > $items_per_page) { $nav_count = 0;
$pag....
Help For My Seagate Sata Hard Drive!
hard drive stops working randomly, please help! (9) I just bought that disk (seagate SATA 500G) half year ago and found it stop working randomly,
resulting the whole system to be dead. BTW, I am using Win XP. I tried to use seatool, provied by
seagate, to scan and repair the error, the program stop at the half of the process. I even can't
format entirely, just do quick format. I don't know what I can do and have been pissed off for a
few days. hope some people have this kind of experience and give me any idea. I don't want to
loss my 500G data storeage. thanks in advance.....
How To Make An Item Scroll With You On The Page.
(10) ok im not sure where or how to really ask this... but you can find an example at
http://www.demonoid.com the ad that is on the right side scrolls with you basically to the bottom
of the page. I know they use an iframe but can you show me how that works or what makes it do that?
i tried to copy the source and css but it did not work.. any advice?....
How Long Does It Take For Google To Index Your Website?
(17) Hey guys. I just sent my url to google and i was wondering if anyone had any experience with how
long it takes to actually be entered into their system and crawled for content? Let me know,
thanks.....
Google Sketchup - Introduction
Please read this and add your models to a Topic. (2) Google Sketch Up is a software available from Google Services that allow you to Draft, Layout, or
generally 'sketch up' designs in two dimensions or in a full 3D mock-up format. The
'Pro' version also allows for exchanging data and designs with other more professional
software packages, like Autocad, Turbocad, and many more. Similar to a drafting program in that you
can do a layout of a design and then extrude it into a 3d shape. As you design 'parts' for
the design, you can then orbit around the 'part' and check all 6 planes. 'Parts....
Web Page Layouts
using Cascading Style Sheets (6) Here are a set of three Web pages I wrote a long time back when I was first starting to develop
sites. The first one is a two columned page with a full length sidebar for navigation links. There
are two that are identical except the sidebar positions are reversed. Another is "one way" to create
a three column layout. And lastly, a 'framed' look on a page. These are not
'fancy', you will need to look into the code and colourize it to suit, maybe set a width and
centre it if you want, whatever... Please feel free to snag the source and develop the pages....
Who Is The Best Writer Did You Ever Read And His Or Her Book
(11) i read lots of books but i cant forget MARIO PUZO THE GODFATHER. this is very serious book that
read. the second book is DAN BROWN's DAVINCI CODE. the third one is JACK LONDON WHITE TOOTH........
Eragon
Anyone else read it? (54) I've just finished reading Eragon and now I'm moving on to read Eldest, and I gotta say,
what a great book! It's a fantasy novel by Christopher Paolini about a young boy about 15
years old who finds a blue stone. It turns out to be a dragon inside and he and his dragon, Saphira,
travel the world seeking revenge for the death of his family. The story unfolds as he forms
alliances and enemies and travels to exotic locations. I'll not say anything else in case
someone is only a little way into the book because I don't want to spoil anything. So, has....
Help In Ipb 2.1.6 Portal Page
plaese help me (2) hi any 1 know how can a add my topics in ipb poratl page in my server i uploaded ipb 2.1.6 plaese
tell me. like this site.....
Tracking My Stolen Laptop
please all read and reply if you can (8) Well 5 am arrives and instead of being fast asleep im awake worrying about where my laptop and loads
of othger stuff has got to... what a great day this is turning out to be, oh and the police dont
seem to think were being honest they think were tryin to do a dodgy insurance
claim...fantastic!!! My laptop dual boots windows and linux the default being windows
so the ******* that stole it will most likely use windows if they use it atall, so what i want is a
way of pinpointing its location, i have remote help installed that is activated whenever the laptop
i....
How To: Change Your Website's Index File
a simple trick using .htaccess (24) How To: Change Your Website's Index File a simple trick using the .htaccess file A simple
tutorial which only involves editing one little file. Useful for those of us who have mime-typed
extensions or who are creating lots of test design files and want an easy way to make the design
they like best their default file. Create a file called .htaccess in the /public_html/ folder if
you don't have it. I think one should be there already when you get your site so if it isn't
you should create it anyway! In the file write the following: CODE Di....
How To Detect And Remove Mp3 Duplicates
Software for search mp3 duplicates on hard disk (14) Plagiarized post. Quotes added. Link below. ? great software for detecting mp3 duplicated is here
http://abeetech.com/mp3-duplicates-finder/ Description: QUOTE The purpose of this program is
to find all mp3 duplicates on your computer and remove useless files from your hard drive. As this
program performs just this single task it copes with it much better than other more universal
programs. Unlike the other programs for duplicate files search, our program works only with mp3
files. This allows using specific methods for duplicates detection. While most of dupl....
Sendearnings.com
Get paid to read emails and click on links (17) Send Earnings Basically, you can make a new e-mail account and sign up on this site, entering
in the new e-mail and information. They will then send you a couple of e-mails a day from various
advertising companies. All you need to do is open up the e-mail, click on the link inside of it, and
read the page. You receive 1-10 cent's for every link you click/e-mail you read, and receive
$5 for every friend you introduce to the site, with your recruiting link. You can supposedly
earn hundreds of dollars per month. Another bonus, is that they are currently havi....
Button To Print Current Web Page
(14) Hi, Does anyone know how to create a button that will printo out the current page. What I want to
do is have the user fill out a form (containing name, address, zip, etc). They will then click on a
"print" button and it will print out the form data. Any ideas? Thanks.....
Im Making A Mmorpg >>
Have a read... (14) can you give your ideas for my new game. if you want to help me even more then send me a private
message Thanks Tyjotr __________________________________________________ HybridHero - the new 3d
MMORPG (coming soon)....
**** Read Before You Post! ****
THIS MAY AFFECT YOUR HOSTING CREDITS (48) These rules were re-written by Dooga THESE RULES ARE IMPORTANT! FAILING TO READ THESE NOTES
WILL RESULT IN YOUR HOSTING CREDITS TO BE DEDUCTED! This forum is a forum to post tutorials
that YOU have written. You are NOT allowed to post a tutorial copied from another site,
regardless of any reference you make! (However, you may PARAPHRASE it with correct
referencing). Your tutorial is going to be moderated (that means, anything you post won't be
viewable until a moderator has accepted it). Do not re-post your tutorials if they don't show
up&....
Last Book You Read?
(203) What was the last book you read? me was "Out of Avalon" the book had different stories about Avalon.
Before, After, During King Arthur's Lifetime....
Read This Before Applying For Hosting!
HIGHLY IMPORTANT! (58) DISCARD THIS PAGE : WE HAVE CREATED A FORM GENERATOR HERE
http://www.trap17.com/forums/click-here-de...ting-t9222.html READ THE FOLLOWING INSTRUCTIONS
CAREFULLY BEFORE APPLYING Once you have the necessary Hosting credits ( check at :
http://www.trap17.com/forums/ ), You can request here by making a new topic and putting in the
following details. BEFORE ACCEPTING YOUR APPLICATION, WE GO THROUGH YOUR EACH AND EVERY
POSTS! SEE TO IT THAT YOU HAVE GOOD QUALITY POSTS. BUILDING A GOOD COMMUNITY IS OUR FIRST
PRIORITY! Its very easy once you get st....
Looking for php, single, page, w, index, php, page, 4, stuff, read, cuz, hard, explain
|
*RANDOM STUFF*
*SIMILAR VIDEOS*
Searching Video's for php, single, page, w, index, php, page, 4, stuff, read, cuz, hard, explain
*MORE FROM TRAP17.COM*
|
advertisement
|
|