Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Moving position of infoline - Have searched but cant fix.  (Read 2412 times)

mikka23

  • Newbie
  • *
  • Karma: 0
  • Posts: 45
    • http://www.webmaster-files.com
Moving position of infoline - Have searched but cant fix.
« on: July 12, 2007, 11:49:48 PM »

Okay I have a new template I am trying to integrate into snews and want to move the info line to just under the h2 tag and before the article starting instead of below and after the article.  How do I do this?  I found the infoline section of coding in snews but didnt know what bits to move.


Any help is appreciated.  I searched and found old topics about this problem but the coding was different, must be a newer version of snews.


Also I would like to break the infoline up so readmore and comments are still below but date and category are above.

Preview of my progress:http://dating.jamroll.net/
Logged

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
Moving position of infoline - Have searched but cant fix.
« Reply #1 on: July 13, 2007, 01:25:16 AM »

mikka,
You could try out my "byline" mod for 1.6, although as you've noted above, the code in 1.5 is a little different. Here's a version I've just done a quick test with in 1.5.31 -- it seems to work in my test scenario, but ... proceed with caution. ;)
(Note, this code prints the category SEF, not the category name, I haven't had time to work out that detail yet.) Hope this helps.

1. BACKUP!

2a. If you want the full byline mod, with permalink, place the following variables in your language variables.
Quote
$l['permalink'] = 'Permalink';
$l['posted_in'] = 'Posted in';
2b. Change your INFOLINE TAGS function to look like this:
Quote
function tags($tag) {
   $tags = array(); $tags['infoline'] = '

,readmore,comments,edit,

'."\n";
   $tags['comments'] = '
,,

,comment,

,
';
   $tags['byline'] = '';
   return $tags[$tag];
}
The blue part is new. Remove the permalink and divider if you're not using that.

3. In CENTER, first find this line:
Quote
$infoline = $r['displayinfo'] == 'YES' ? true : false;
On a new line before that string, place this code:
Quote
$byline = $r['displayinfo'] == 'YES' ? true : false;
4. A few lines further down, after "echo '';" but before the following closing bracket, place this code:
Quote
if ($byline == true) {
                  $tag = explode(',', tags('byline'));
                  $link = ''.l('permalink').' '; break;
                        case ($tag == 'category'): echo $link.$category.'/" title="'.$category.'">'.$category.' '; break;
                        default: echo $tag;
                     }
                  }
               }
And that should do it. What you should get is something similar to the article layout on http://www.frdk.com/. Just make sure that your code after the closing contains enough closing brackets. Here's how the whole snippet looks in my test installation:
Quote
if (!$result || !$numrows) {echo '

'.l('not_found').'

';}
      else {
         while ($r = mysql_fetch_array($result)) {
            $byline = $r['displayinfo'] == 'YES' ? true : false;
            $infoline = $r['displayinfo'] == 'YES' ? true : false;
            $text = stripslashes($r['text']);
            if (!empty($currentPage)) {$short_display = strpos($text, '[break]'); $shorten = $short_display == 0 ? 9999000 : $short_display;}
            else {$shorten = 9999000;}
            $comments_query = "SELECT * FROM ".db('prefix')."comments WHERE articleid = $r[id] AND approved = 'True'";
            $comments_result = mysql_query($comments_query);
            $comments_num = mysql_num_rows($comments_result);
            $a_date_format = date(s('date_format'), strtotime($r['date']));
               $position = $r['position'];
            $category = $r['category'] == 0 ? $home : retrieve('seftitle', 'categories', 'id', $r['category']);
            $title = ($r['title']);
            echo '
';
            if ($r['displaytitle'] == 'YES') {
               echo '

';
               if (strlen($text) > $shorten) {
                  echo ''.$r['title'].'';
               }
               else {echo $r['title'];}
               echo '

';
               if ($byline == true) {
                  $tag = explode(',', tags('byline'));
                  $link = ''.l('permalink').' '; break;
                        case ($tag == 'category'): echo $link.$category.'/" title="'.$category.'">'.$category.' '; break;
                        default: echo $tag;
                     }
                  }
               }
            }
            file_include(str_replace('[break]', '', $text), $shorten);
Logged

mikka23

  • Newbie
  • *
  • Karma: 0
  • Posts: 45
    • http://www.webmaster-files.com
Moving position of infoline - Have searched but cant fix.
« Reply #2 on: July 13, 2007, 01:34:30 AM »

Thanks in advance for you time.  I will try this out tomorrow.  I am currently partially asleep :D
Logged