Welcome, Guest. Please login or register.
Did you miss your activation email?
May 23, 2012, 10:10:47 AM

Login with username, password and session length
Search:     Advanced search
Wollen Sie dem WebsiteBaker Team beitreten?
Nähere Informationen finden Sie unter hier und auf unserer neuen Webseite.
155401 Posts in 21698 Topics by 7729 Members
Latest Member: adnan
* Home Help Search Login Register
Pages: 1 [2]   Go Down
Print
Author Topic: How do I call on a seperate stylesheet for these pages? Any other ideas?  (Read 3594 times)
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2294



WWW
« Reply #25 on: September 27, 2008, 09:11:40 PM »

@Kweitzel

TEMPLATE_DIR is the http representation of the template path. You cannot use file_exists('http://.....');
That's why we used WB_PATH /etc.. in the previous solution.

@sparkdigital

There is nothing wong with the code.. But..
I think you are using a .htaccess to rewrite the url's and without the .htaccess there is a hidden parent page.
The routine above looks foor the root_parent. This is the first parent level above the root.
I think your page setup is something like:

-
- romantic-cottages
- romantic-cottages - scotland
- romantic-cottages - scotland - dumfries-and-galloway
- romantic-cottages - scotland - dumfries-and-galloway - tuc-tin-moffat

For the "scotland" page there is a template on the page_id
For the "dumpfries" page the root_parent is "romantic-cottages"
For the "tuc-tin-moffat" page the root_parent is "romantic-cottages"

So, if my assumption about the .htaccess is correct, our trick will not work with this setup.
You can get the level above the schotland page working by using $parent = $d_parent['parent']; instead of $parent = $d_parent['root_parent'];, but for the next level that won't work anymore.

Ruud
Logged

Professional WebsiteBaker Solutions
vyni

Offline Offline

Posts: 566


« Reply #26 on: September 28, 2008, 01:59:12 AM »

Hi Konrad,

Quote
What I would like to do is create one template for the whole website but have a different body background image per topic (and thus for all pages in that topic).

Is this still the target?

Try this:
in the index.php of Your template add to body-tag the background-image like this
Code:
<?php ignore this php-tag this is just for coloring this code


<body background="<?php echo TEMPLATE_DIR; ?>
/background/bg<?php echo PARENT?>.jpg">

create a folder background in Your template-directory
put Your background-image in this folder and name it
bg0.jpg (for the top-level)
bg1.jpg (for the 2nd level)
bg2.jpg (for the 3rd level)
bg3.jpg (for the 4th level)


of course - remove the background-image from the css file and do the rest of the formatting as usual in body {......}

no more - no less

regards from Himberg, next to Vienna
Logged

PS: Falls jemand eine Idee hat was zu tun ist und mir das erklären könnt - geh bitte davon aus dass ich ahnungslos bin, was php und so betrifft. Ich kann grad was lesen, kopieren und einfügen,  ungefähr verfolgen und glauben.
sparkdigital

Offline Offline

Posts: 348



WWW
« Reply #27 on: September 29, 2008, 10:25:57 AM »

Thanks Ruud,

That makes sense now. The top directory is only hidden by using showmenu2, but I don't suppose that makes any difference anyway...

I'll probably end up using a css for each county (dumfries) rather than every area (scotland) which is something I wanted to do anyway when I had the time to do so.

Thanks for your help!

Konrad
Logged
Stefek
WebsiteBaker Org e.V.

Online Online

Posts: 4883



« Reply #28 on: October 01, 2008, 10:38:16 AM »

Hallo Spark,

I have another solution for you, using SM_2 and less code.

Please try this instead of your <body> tag.
For me it's working very good.

Code:
<body class="body_<?php show_menu2(0SM2_ROOT,SM2_MAXSM2_CRUMB'[page_id]'''''''''); ?>">

Then, in your CSS file you only need to declare your pictures in the diffrent body classes.

Feedback appriciated.

Regards,
Stefek
« Last Edit: October 01, 2008, 12:18:32 PM by Stefek » Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
Stefek
WebsiteBaker Org e.V.

Online Online

Posts: 4883



« Reply #29 on: October 01, 2008, 12:26:21 PM »

Hello again.

Of course you can use this snippet also for the stylesheet.

Code:
<link href="<?php echo TEMPLATE_DIR?>/screen.css" rel="stylesheet" type="text/css">
<!-- additional css CALL by parent-->
<link href="<?php echo TEMPLATE_DIR?>/additional-styles/css_<?php show_menu2(0SM2_ROOT,SM2_MAXSM2_CRUMB'[if(level>0){active} else {[page_id]}]'''''''''); ?>.css" rel="stylesheet" type="text/css">

Regards,
Stefek
Logged

"In a time of universal deceit, telling the truth becomes a revolutionary act."
- George Orwell, Nineteen eighty-four (1984)
mquattrone

Offline Offline

Posts: 2


« Reply #30 on: January 29, 2009, 09:23:20 PM »

I use the following on my WebsiteBaker sites.

Code:
<body class="pId<?php echo (PARENT != 0) ? PARENT PAGE_ID?>">
Logged
Pages: 1 [2]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!