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: How to display page description in the page itself ?  (Read 6453 times)

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
How to display page description in the page itself ?
« on: March 28, 2007, 09:02:02 AM »

Hello

I'm reading "Tips and trix" and din't find the answer (either in the forum).

I'ld to have the page description displayed at the top of each page.

Si I tried to display it by inserting
Code: [Select]
<? page_description(); ?>at the top of the page.

But it doesn't work. :|

Is there a way to do that. ?
Thanks for any relevant answer.  :lol:
« Last Edit: January 02, 2009, 06:22:37 AM by Joost »
Logged

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
How to display page description in the page itself ?
« Reply #1 on: March 28, 2007, 09:08:50 AM »

so, you want to display the article meta description using the above code or similar?
Logged
Of all the things I have lost, it is my mind that I miss the most.

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
How to display page description in the page itself ?
« Reply #2 on: March 28, 2007, 09:15:14 AM »

Hello philmoz

I want to display the page description not in the header as a meta tag but as body tag.

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
How to display page description in the page itself ?
« Reply #3 on: March 28, 2007, 09:25:25 AM »

try this little function. Paste into snews.php, and use the code you tried before.
Quote
function page_description(){
   $articleSEF = get_id('article');
   if (!empty($articleSEF)) {
      $query = "SELECT description_meta FROM ".db(prefix)."articles WHERE seftitle = '$articleSEF'";
      $result = mysql_query($query);
      while ($r = mysql_fetch_array($result)) {$dmeta = $r['description_meta'];}
   }echo $dmeta;
}
This is likely to have room for improvement.!! :D
Logged
Of all the things I have lost, it is my mind that I miss the most.

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
How to display page description in the page itself ?
« Reply #4 on: March 28, 2007, 09:43:51 AM »

philmoz, you are a Chef !
It's working great.
Thanks a lot for your help.
Have a nice day with your spider.
 :cool:

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
How to display page description in the page itself ?
« Reply #5 on: March 28, 2007, 10:14:10 AM »

Hehe, no offence Philippe, but you just told Phil he's a cook/chef, boss in the kitchen :lol: and it's true in a way... There are a number of chef's cooking this soup we call sNews, and Phil is one of them...
Logged
My sNews site
"It's only dead fish that goes with the flow... "
Updated, online again - Free designs

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
How to display page description in the page itself ?
« Reply #6 on: March 28, 2007, 10:33:09 AM »

Quote from: Patric
Hehe, no offence Philippe, but you just told Phil he's a cook/chef, boss in the kitchen :lol: and it's true in a way... There are a number of chef's cooking this soup we call sNews, and Phil is one of them...
:)
So this is a gift as a tribute to his knowledge.  :D

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
How to display page description in the page itself ?
« Reply #7 on: March 28, 2007, 12:34:18 PM »

well, to be totally honest, most of the code in this little function was lifted directly from the title() function of which I may claim absolutely zilch originality  ;)
Logged
Of all the things I have lost, it is my mind that I miss the most.

piXelatedEmpire

  • MIA
  • ULTIMATE member
  • ******
  • Karma: 37
  • Posts: 1401
  • currently MIA
How to display page description in the page itself ?
« Reply #8 on: March 29, 2007, 01:40:30 AM »

handly little addition - repost in MODs phil?
Logged
my apologies to the sNews crew, but I will be MIA for the forseeable future

Mika

  • Hero Member
  • *****
  • Karma: 9
  • Posts: 1377
    • http://www.ni5ni6.com/
How to display page description in the page itself ?
« Reply #9 on: March 29, 2007, 06:34:40 AM »

Here's another trick where you can utilize retrieve function()
Quote
# snews.php
function page_description(){
$articleSEF = get_id('article');
if (!empty($articleSEF)) {
echo retrieve('description_meta', 'articles', 'seftitle', $articleSEF);
}
Quote
# index.php
Logged
http://www.ni5ni6.com/ - Tutorials, Mods and How-To's about sNews CMS
sNews 1.6 Developers Edition - commented sNews 1.6 version

Sven

  • ULTIMATE member
  • ******
  • Karma: 88
  • Posts: 2029
  • Chasing MY bugs!
    • hiseo.fr - rédacteur Web
How to display page description in the page itself ?
« Reply #10 on: June 19, 2007, 02:39:54 PM »

Oops!
Checking my sNews 1.31 with the Mods I 've installed I realize I missed your answer Mika.
So thanks a lot for it.
Quote from: piXelatedEmpire
handly little addition - repost in MODs phil?
I missed yours too, Pixel.
Has it been modded ?