Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: Styling an article  (Read 9487 times)

ddolan88

  • Guest
Styling an article
« on: April 14, 2008, 05:13:52 PM »

I need to style the text that comes after the title of an article, and the text after the title of a post in the 'extras' tag, but can't find the part of the code I need to add the <p> around. Can anyone tell me which lines I need to edit?

Thanks
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Re: Styling an article
« Reply #1 on: April 15, 2008, 01:06:18 AM »

Hi,

First, make sure that you have a backup.

Next, In snews.php, find function center() and locate the following line (≈ line 523):
Code: [Select]
if ($r['displaytitle'] == 'YES') {echo '<h2>'.(strlen($text) > $shorten ? $link.$category.'/'.$r['seftitle'].'/" title="'.$title.'">'.$title.'</a>' : $title).'</h2>';}
Next, go to the end of that line and make a new line, where you put this:
Code: [Select]
echo '<div class="container-name">';
Next, on the following line you will find this code:
Code: [Select]
file_include(str_replace('[break]', '', $text), $shorten);
Go to the end of that line; stay as low as you can. Make a new line and add the following:
Code: [Select]
echo '<div>';
Then you can save snews.php and open your CSS stylesheet, to add the styling you need for the class name you entered (e.g. 'container-name')

If you have observed the rules of specificity you should be good to go.

Note that this only wraps the article body in a container (I've used a div in the example because it's more flexible), not the comments or the info line etc, just the article body.
« Last Edit: April 15, 2008, 01:11:28 AM by Fred K (agentsmith) »
Logged

Tsu

  • Newbie
  • *
  • Karma: 0
  • Posts: 6
Re: Styling an article
« Reply #2 on: June 16, 2008, 10:13:29 AM »

The last div should be closed :) like this:
Code: [Select]
echo '</div>';

One question for me. I need to redesign the tittle itself. Is the text wrapped in <h2> tags tittle? I'm not shure, so I rather ask ...

P.S: I'm new on this forums :)
Logged

Joost

  • Guest
Re: Styling an article
« Reply #3 on: June 16, 2008, 10:30:42 AM »

The last div should be closed :) like this:
Code: [Select]
echo '</div>';

One question for me. I need to redesign the tittle itself. Is the text wrapped in <h2> tags tittle? I'm not shure, so I rather ask ...

P.S: I'm new on this forums :)
Welcome Tsu. :)

Yes, they are. It is inside snews.php in function center
Logged

Tsu

  • Newbie
  • *
  • Karma: 0
  • Posts: 6
Re: Styling an article
« Reply #4 on: June 16, 2008, 10:52:16 AM »

Thanks.

This is my line for tittle in center() function:
Code: [Select]
echo '<h2>'.(strlen($text) > $shorten ? $link.$category.'/'.$r['seftitle'].'/" title="'.$title.'">'.$title.'</a>' : $title).'</h2>';

But when looking the source on compiled page, I get no link. Where is the error? Is there supposed to be an ancor beggining tag, or does that come along with those functions inside?

Thanks for help.

Tsu
Logged

Joost

  • Guest
Re: Styling an article
« Reply #5 on: June 16, 2008, 11:08:55 AM »

Compiled page? You mean the html source?
There is only a link shown when a part of the content is shown on the frontpage or category.
Logged

Tsu

  • Newbie
  • *
  • Karma: 0
  • Posts: 6
Re: Styling an article
« Reply #6 on: June 16, 2008, 11:13:17 AM »

Yes html source. If the article is shown its tittle is a link, or isn't? So if you click on its tittle the article is shown throu a whole page with comment function underneath. Am I missing something here? :)
Logged

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Styling an article
« Reply #7 on: June 16, 2008, 01:09:04 PM »

@Tsu,
You need this mod. In standard version, Title is clickable only if article is split with [break]. With that mod, title is clickable not matter if is entire article on home page or just a short version.
Logged

Tsu

  • Newbie
  • *
  • Karma: 0
  • Posts: 6
Re: Styling an article
« Reply #8 on: June 16, 2008, 01:58:10 PM »

Aaa thanks, did not know that :)
I'll try that.

Thanks again :)
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: Styling an article
« Reply #9 on: June 27, 2010, 05:17:31 PM »

hi.. me again.. does anyone know how to add the space i mention in the previous post??? thanks

Please provide a link to your "previous post" or explain what you are referring to.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU