Closed Thread Icon

Topic awaiting preservation: PHP Template problem for CMS (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=13042" title="Pages that link to Topic awaiting preservation: PHP Template problem for CMS (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: PHP Template problem for CMS <span class="small">(Page 1 of 1)</span>\

 
PVision
Obsessive-Compulsive (I) Inmate

From:
Insane since: Oct 2003

posted posted 01-24-2004 23:06

Hello everybody, its been a while since ive been here. but too the point.

I am currently working on a Content Management System for a client that I have. I have made an administration and everything... but the problem that I am having comes the from the templates area.

I work the templates by having subdirectories inside of the directory "templates" and inside of this is directories for the template name and inside of that is the index.html and images for the template. Confusing how explained it, here is an example.

I go to http://site.com/index.php?template=AboutTemplate, and it loads the template, but the images arent working becuase the path of the images are in the templates/AboutTemplate/ folder.

I can get PHP to get the coding from the index.html file, parse it and include it into the page. But the images wont show because they are in the templates folder.

is there a way that I can make the images work without having to put the absolute paths for every image in the template file. For instance, is there a way with PHP to include the files contents and find out where all the images are supposed to be located in show them... im probably just confusing you all.

Thanks for your help, if you are confused i will try to explain better. basically its an image path problem with a template system to simplify the problem.

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 01-26-2004 09:58

Well without seeing the code and the structure of where everything is in relation to each other it's a wee bit hard to help...

Based on what you write you should be able to do it this way:
By writing the image tag from PHP, like this:
<img src="/templates/".$_GET['template']."/image_name.jpg">
that way you use whatever is in the GET variable "template" as the name for the correct template folder (at least that's what I guess you store in that variable) plus that the preceeding "/" in the image path tells the server to start looking in the rootfolder of the site.

Based on the info you give that's the best I can do.
/Dan

{cell 260}
-{ a vibration is a movement that doesn't know which way to go }-

PVision
Obsessive-Compulsive (I) Inmate

From:
Insane since: Oct 2003

posted posted 01-30-2004 04:07

Thank you for your responce DmS.

I should have explained it a little better. But i just decided to make it absolute paths for all the images. But basically, I am creating a Content Management System for my clients. Inside of it you are able to add content, edit, make templates for the content, have categories and what not. It has been around 2 weeks now that i have been working on it and it is almost ready for use for my clients. you can make content using a wysiwysg editor and all. Im not going to put the link for it though becuase I still need to implement a password protection.

I actually have to have it ready for use by tomarrow. Im just working on the news management part of it right now. should finish on time.

But thank you for your help and just wanted to say, im going good. hehe. thanks again.

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 01-30-2004 11:17

Cool, good luck with it then
/Dan

{cell 260}
-{ a vibration is a movement that doesn't know which way to go }-

« BackwardsOnwards »

Show Forum Drop Down Menu