Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
|
|
php Include and Site Content |
Page: 1 | Reply |
Feb 18th 2003 | #91199 Report |
Member since: Dec 14th 2002 Posts: 1 |
Ok, Site I have has mulitple (6)pages of same content except Information in one table . Right now the page is in .php for includes of shoutbox and poll and News portalled from Forum. So the Main.php is set on how I like it, what I would like to do is be able to just have a navigation link change only the content that sits in this table and so forth for the other 5 pages. Can this be done? Idea is not to reload entire page and and I imagine the link that displays would be something.net/main.php?=&link I have gone through plenty of sites and as they were informational none seem to touch on what I imagine is probably pretty basic and makes for a pleasure to view a site. I do understand that php is more database driven, but I would imagine that such a task as this does not require a database . If someone could explain how I could setup the code for it I can finish for the rest of the pages and also what code would need to reside where the table I want to change need to be? -thx- |
Reply with Quote Reply |
Feb 19th 2003 | #91616 Report |
Member since: Jun 30th 2001 Posts: 447 |
Take a look at the PHP function manual and learn to use include() and require().
|
Reply with Quote Reply |
Feb 20th 2003 | #91745 Report | |
Member since: Mar 24th 2002 Posts: 3114 |
Yes, include() is what you want. Just make files with the contents, and include them in the respective places. (inside a cell, probably) As an example: [PHP] include($id); ?> | [/PHP] And give a value to that variable with a link as in: <a href="index.php?id=about_us"> <-- that would make the site attempt to include a file named "about_us". I'm sure you get the idea. |
Reply with Quote Reply |
Mar 15th 2003 | #95486 Report |
Member since: Nov 18th 2002 Posts: 267 |
This seems kinda similar to my question, so I'll ask here instead of starting a new thread. Anyway, I've made this website www.channelphotography.com and on each section, there are some images, and when you click them, a jpeg is loaded into a separate window. The guy I'm making the site for, wants the background to be a certain colour and maybe have some info on there to. Without making an HTML page for each image, is it possible to get php to sort of generate the page itself, even if it meant building a template, and then having the relevant info in th link itself? I'm not asking how to do this, just whether or not it's possible or not. ThanX in advance, BYEEEEE!! |
Reply with Quote Reply |
Mar 15th 2003 | #95499 Report |
Member since: Mar 24th 2002 Posts: 3114 |
it's possible. Just make two or three files with the info in them. (as in the name of the link, the explanation of the link, and the name of the image itself) The go on from there. If you need further help, just ask here. |
Reply with Quote Reply |
Mar 15th 2003 | #95502 Report |
Member since: Nov 18th 2002 Posts: 267 |
I don't think I'll even need it to be that complex. The guy basicly want a plain page that has a blue background with the image in the middle and a link to the contact page or some contact information, so what I wanted to do was load up a page which has a table with a centered image and the contact info and tell that page which image to load via the link that was clicked or something, is that possible? I'm a real newbie to PHP, I only got my PHP & MySQL book two days ago. |
Reply with Quote Reply |
Mar 15th 2003 | #95508 Report |
Member since: Mar 24th 2002 Posts: 3114 |
ok, that's really very basic. I'll write you a script... *opens notepad*
|
Reply with Quote Reply |
Mar 15th 2003 | #95510 Report |
Member since: Mar 24th 2002 Posts: 3114 |
ok, this is to loop out the links to the images: (he will only need to upload the pics to a folder called "photos", that's all) [PHP] $dp=opendir("photos/); while($file=readdir($dp)){if(strchr($file,".jpg" OR $strchr($file,".gif"))){$pics[]=$file;}}; closedir($dp); for($i=0;$i $pics[$i] \n "; } ?> [/PHP] And this is the stuff to go into the file called "showpic.php" -> [PHP] $contactinfo="CONTACT ME!!!!!"; echo " $contactinfo "; ?> [/PHP] I haven't tested this, so I'm not sure it'll work perfectly. :| |
Reply with Quote Reply |
Mar 15th 2003 | #95513 Report |
Member since: Nov 18th 2002 Posts: 267 |
That's probably more code than I wanted or is even necessary. Ok, I've got the theory: What I want is when you click a link, a single variable is passed to the page which opens. I already have a filing system, so I don't need any of that auto STufF which I think you put in. All the pictures are called 1.jpg, 2.jpg and 3.jpg, they way we know what they are is based on the folder they're in. So I want the link to look something like: (a href="imageview.php" target="_blank" $imageload="images/ashford/1.jpg")(img src="thumbnails/ashford/1.jpg")(/a) Replace the circle brackets for pointy ones, I can't get it to show up properly. Do you see what I mean? Then the imageview.php file will load and display the image from the path that it's been given like above. I dunno if I've got the actual code right, but that's the idea I have. ThanX a lot anyway, it's appreciated. |
Reply with Quote Reply |
Mar 15th 2003 | #95515 Report |
Member since: Mar 24th 2002 Posts: 3114 |
well, then all you need is the second part of code I wrote. EDIT: And link it as in: <a href='showpic.php?id=1.jpg'> |
Reply with Quote Reply |
Page: 1 | Back to top |
Please login or register above to post in this forum |
© Web Media Network Limited. All rights reserved. No part of this website may be reproduced without written permission. Photoshop is a registered trademark of Adobe Inc.. TeamPhotoshop.com is not associated in any way with Adobe, nor is an offical Photoshop website. |