Hello,

I would like to know how to call a theme in a custom made CMS. I have some very primitive bootstrapping done (I dont really know how to do it). I have finished the functions I need and I have actually finished the theme aswell, the only problem is that I dont know how to call it so that it would include all the styles and images in the theme not just the files i can <?php innclude() ?>. Any help would be appreciated. (Also some reading on bootstrapping would be great too, if anyone knows a source where it can be done )

Thanks in advance!

P.S Can it be dont with mod_rewrite ? If so then how ?

Recommended Answers

All 5 Replies

Am not quite sure how your theme is defined, but usually your HTML would just be pointing to a single CSS file. I have a theme folder, where there's a subfolder per theme, including all additional images. My HTML would then point to the selected theme: /themes/black-and-white/default.css Bootstrap links:
http://stackoverflow.com/questions/3313950/php-bootstrapping-basics
http://stackoverflow.com/questions/501505/php-bootstrapping-better-method

commented: thanks for bootstrap links +1

I have the same structure that you. The HTML that points is in what folder then ? Root folder ? Cause I have two different index.php files. One is in root folder which is requested when use comes on my server, so that file should load the actual theme index.php from themes/theme-name folder. And in that index.php which is in theme folder I should be able to refer to styles as usual e.g /style/style.css or /images/image.png. I hope I didnt express myself too confusingly. Thanks for the reply and links!

If you use the correct absolute (or relative) links, then it should not be a problem.

It would work with aboslute paths, but at some point I may want others to be able to develope themes for my CMS, so relative path sound a lot better, but I cant use the IF I include or require the index.php from themes folder into index.php at root folder. The relative paths would point to the folders on my root folder instead then, and not to the files in my themes folder. Or maybe I have misunderstood you, I hope you can answer and make it clear to a knucklehead like me.

EDIT: Or I could make a function that generates the <head></head> part of my index.php in themes folder and make that function to automatically turn relative links into absolute. Is that what you meant ?

It worked, problem solved!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.