Pirate King Posted August 25, 2008 Share Posted August 25, 2008 Hey there, I'm working on a webcomic website. I'm using Server Side Includes to make it cleaner, more efficient and just plain easier to change the layout. Anyway, I have the index.html file that basically contains includes of the top(top.html) of the layout and the bottom half(bottom.html). The layout uses many images, and the images are stored in a folder /images. I also have the folder /comics/Series 1. However, as I'm using SSI the index page in that still use the very same top.html and bottom.html files. The images fail to appear, as the images aren't in /comics/Series 1/images, they're just in the /images folder. I do not want to have to have different top.html/bottom.html files for different folders as I want only two files to control the layout. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Fadion Posted August 25, 2008 Share Posted August 25, 2008 I guess you won't have problems if the images are set relatively. If you have a folder structure like this: root _comics |_series1 |_images _images _includes The includes file, ie. top.html will point to the images as: "images/image1.jpg", which is the same way "comics/series1" will need to point to the images. That way it should be fine. Quote Link to comment Share on other sites More sharing options...
Pirate King Posted August 25, 2008 Author Share Posted August 25, 2008 Does that mean I have to double up on the images folder? This is my current folder structure: Root index.php Top.html bottom.html _Images _Comics |_Series 1 Index.html Quote Link to comment Share on other sites More sharing options...
Fadion Posted August 25, 2008 Share Posted August 25, 2008 My guess was you had an images folder inside "comics/series1". In that directory structure, you'll have to double the images folder, or have different included files. As you have them, the top.html points to images like: "images/image1.jpg", while comics/series1/index.html points to them like: "../../images/image1.jpg". There is no way you can use the same files, you'll have to double up the included files, or the images folder. I'd go for the included files. Quote Link to comment Share on other sites More sharing options...
Pirate King Posted August 25, 2008 Author Share Posted August 25, 2008 Aw poo. I think what I'm gonna go for is is put all pages in the same folder so I don't have Comes/Series and stuff. However, while this is off topic from my original question. Just say I have a page with the following links. Comic 1 Comic 2 Comic 3 How could I make it so that (all one one comics.php page), when Comic 1 is selected, that particular comic appears (with a link attached so that when you click the image it can take you to a larger version of it). And then the same could apply to Comic 2, 3, and then any one I add. Thanks in advance, and sorry if I needed to make a new thread, I just didn't want to uneccessarily add one. Quote Link to comment Share on other sites More sharing options...
Fadion Posted August 25, 2008 Share Posted August 25, 2008 On the index/comics page, you can have: <a href="comics.php?c=comic1">Comic 1</a> <a href="comics.php?c=comic2">Comic 2</a> on comics.php: <?php $comic = $_GET['comic1']; if(file_exists($comic . '.php')){ //check if the file you are going to include exists include($comic . '.php'); } else{ echo 'Bad url. You should not be here.'; } ?> The same idea can be used if you have stuff stored in a database. The url of type: "comics.php?c=something" contains GET variables ("c=something") which can be retrieved using the $_GET superglobal. Basically you have a main template page which includes other files based on the url (get) variable. Quote Link to comment Share on other sites More sharing options...
Pirate King Posted August 25, 2008 Author Share Posted August 25, 2008 I had some trouble applying it to my webpage (sorry). I'll try and explain my situation so it can be more specifically applied to my situation. File structure: Root top.html bottom.html index.php comics.php _images _Series1 |_2-AComputer.png _2-AComputer_LARGE.png _10-Glasses.png _10-Glasses_LARGE.png I basically want the comics.php page to look like this: Links in red, text in black, images in blue. A Computer Glasses ________________________________ | | | | | | | Image | | | | | | | | | |______________________________| Click here for larger version of image. I would like it so that any time A Computer or Glasses would be clicked, both the image and the link for 'click here' would change accordingly, but the links to different comics would still be retained. Sorry if I am frustrating, but I have extremely limited knowledge as to these sorts of things. Quote Link to comment 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.