Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 4

Author Topic: [MOD] Body and ID, a modification I need help with!  (Read 15564 times)

Tjobbe

  • Full Member
  • ***
  • Karma: 0
  • Posts: 112
    • http://www.farstyle.com
[MOD] Body and ID, a modification I need help with!
« on: February 25, 2006, 02:55:32 pm »

Hey everyone!

I'm working on my blog site and a new design to go along with 1.4.

The navigation I have would work best if it could read the id of the body tag, and I'd like the body tag in snews to be dependent on which category is being viewed.

The design im working off is here:

http://www.farstyle.com/2006/new.php

As you can see, the is telling the CSS stylesheet to give the Home link a certain style, in this case a grey background.

On my actual Snews page: http://www.farstyle.com/2006/ Its a little harder to do this, so I have added a to the tag. hoping I can figure out, with some help from here, how to make this work properly.

The CSS:
Code: [Select]
#home #item1, #personal #item2 , #webdesign #item2 , #contact #item2the html:
Code: [Select]
HomeFirstly, the link must have an id assigned to it, in this case, "#item1". and then the body tag needs to have the corresponding id tag as well, in this case, "#home".

How can I do this so the menu adds an id, and the body id is displayed depending on the page it is on?

I'm basic with PHP, so I guess I'm asking for someone to do this for me, seeing as I don't think I can manage it. Hope you don't think I'm being lazy, I genuinely know very little, not ebnough to do this anyway.

Is this actually possible with PHP?

If someone can come up with something, I would give them a big kiss.  ;D

Thanks in advance for any advice!  ;)
Logged

bryn

  • Hero Member
  • *****
  • Karma: 2
  • Posts: 934
    • http://www.cssugly.com
[MOD] Body and ID, a modification I need help with!
« Reply #1 on: February 25, 2006, 08:19:32 pm »

have a read of this Tj..it might help to get the result you want..though it might not be able to be tailored to suit your exact needs

I am trying to work with Luka and Albert..well asking..to see if we can't get some article/category specific page content solution, and then you would be able to assign different body id's depending on where you are

to have this kind of functionality built into snews would take some work, but as an addon/hack..

this would be such a handy feature as if stable..you would be able to safely use different stylesheets without having to have the user manually switch them..this then means you could for instance collapse a 3 column template down to a 2 column one..etc ;D
Logged
Over 1,000 posts of joy, sNews is not only brilliant, but fun too! thanks guys :D

Tjobbe

  • Full Member
  • ***
  • Karma: 0
  • Posts: 112
    • http://www.farstyle.com
[MOD] Body and ID, a modification I need help with!
« Reply #2 on: February 26, 2006, 12:01:02 pm »

Thanks for the reply Bryn.

 I'm thinking that another way of doing it would be not including the "" tag and instead hard-coding the menu once the categories have been set up. That way you can add an id to the URL manually. Not ideal if it was to be a built-in solution I know, but probably what I will be doing if I find a way to tell the body id what to do!

What I'm thinking of now, in psuedo code, is this:

Quote
IF
     { active category = home
}
then
     { echo body id="home" }
else
IF
     { active category = contact
}
then
     { echo body id="contact" }



Does this sound do-able?
Logged

bryn

  • Hero Member
  • *****
  • Karma: 2
  • Posts: 934
    • http://www.cssugly.com
[MOD] Body and ID, a modification I need help with!
« Reply #3 on: February 26, 2006, 12:38:32 pm »

It is do-able I believe yes..I have some code now thanks to the kindness of this forum and one guru coder in particular ;)

I havn't tested it yet as I'm a bit tied up here today..will do later though, and as long as the code originator says it's ok to publicly post it..I will..I need to check with him first ok out of respect for his workings.

Also as this code has the potential to open up all kinds possibilities for snews interaction, I think we should make sure that it works flawlessly..your method is basically it yes..but it was how to grab the category id and not the article id as was posted in Luka's also working code

Let you know later ok ;D
Logged
Over 1,000 posts of joy, sNews is not only brilliant, but fun too! thanks guys :D

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
[MOD] Body and ID, a modification I need help with!
« Reply #4 on: February 26, 2006, 12:39:36 pm »

mhm...sounds something is about to go well for me and my four col layout if this keeps going on ;)

Oh, and if you'll be allowed to post this code, will that come with a possible layman explaination on how to go about in order to make this
function...I'm talking - "so I can understand it" ;)
Logged
"It's only dead fish that goes with the flow... "
Updated

Tjobbe

  • Full Member
  • ***
  • Karma: 0
  • Posts: 112
    • http://www.farstyle.com
[MOD] Body and ID, a modification I need help with!
« Reply #5 on: February 26, 2006, 12:40:38 pm »

Excellent, looking forward to it Bryn! Keep us posted  ;)
Logged

bryn

  • Hero Member
  • *****
  • Karma: 2
  • Posts: 934
    • http://www.cssugly.com
[MOD] Body and ID, a modification I need help with!
« Reply #6 on: February 26, 2006, 01:11:31 pm »

Quote from: Patric
mhm...sounds something is about to go well for me and my four col layout if this keeps going on ;)

Oh, and if you'll be allowed to post this code, will that come with a possible layman explaination on how to go about in order to make this
function...I'm talking - "so I can understand it" ;)

Well yes that'll be the plan Patric..first check to see if it works, then check to see if it's ok to post it, then explain exactly how it can be done and show a working example or two..

I think that's the best way ;D
Logged
Over 1,000 posts of joy, sNews is not only brilliant, but fun too! thanks guys :D

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
[MOD] Body and ID, a modification I need help with!
« Reply #7 on: February 26, 2006, 01:16:23 pm »

I quote Tony the tiger when I say - "Grrrrrrrrrrrrrrrrrreat !!"
Logged
"It's only dead fish that goes with the flow... "
Updated

Tjobbe

  • Full Member
  • ***
  • Karma: 0
  • Posts: 112
    • http://www.farstyle.com
[MOD] Body and ID, a modification I need help with!
« Reply #8 on: February 28, 2006, 06:48:44 pm »

Hey Bryn, have you heard anymore on this subject?
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
Logged
"It's only dead fish that goes with the flow... "
Updated

albert

  • Sr. Member
  • ****
  • Karma: 0
  • Posts: 405
    • http://www.oswt.co.uk/
[MOD] Body and ID, a modification I need help with!
« Reply #10 on: February 28, 2006, 07:39:06 pm »

Hi

try using lukas code here..

Code: [Select]










right();
} ?>

that should do the trick :)

Albert


Logged
Albert
http://snews.awddesign.co.uk/snews/ site: v1.3
http://snews.awddesign.co.uk/           site: v1.2 http://www.awddesign.co.uk/
“Putting together the largest collection of sNews 1.5 designs. Coming very soon :)

Tjobbe

  • Full Member
  • ***
  • Karma: 0
  • Posts: 112
    • http://www.farstyle.com
[MOD] Body and ID, a modification I need help with!
« Reply #11 on: February 28, 2006, 08:06:01 pm »

fantastic, will give that a try albert!
Logged

Luka

  • Administrator
  • ULTIMATE member
  • ******
  • Karma: 36
  • Posts: 1717
    • http://www.snewscms.com
[MOD] Body and ID, a modification I need help with!
« Reply #12 on: February 28, 2006, 08:18:03 pm »

Hey Patric and anyone else:

Here's a rough and totally simple solution.

Use this in your index.php:

Code: [Select]

"archives" AND get_id('category') <> "contact") { ?>











What will this do?
It will display those columns only when you're not reading an article or viewing contact form and archives.
Logged

bryn

  • Hero Member
  • *****
  • Karma: 2
  • Posts: 934
    • http://www.cssugly.com
[MOD] Body and ID, a modification I need help with!
« Reply #13 on: February 28, 2006, 09:17:58 pm »

cool Luka ;D
Logged
Over 1,000 posts of joy, sNews is not only brilliant, but fun too! thanks guys :D

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • “I'm a self-made man and worships my creator.”
    • p-ahlqvist.com
[MOD] Body and ID, a modification I need help with!
« Reply #14 on: March 01, 2006, 08:54:53 am »

I will make sure togive this a go...where in the indexfile ? Does it matter (so many things do when talking PHP) ?

P
Logged
"It's only dead fish that goes with the flow... "
Updated
Pages: [1] 2 3 4