Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
warren-the-ape
Worker
Worker


Joined: Nov 19, 2007
Posts: 196
Location: Netherlands

PostPosted: Thu May 01, 2008 1:21 pm Reply with quote

Ey guys,
Thought i'd might drop by again Wink

I used the search for this one and did found some things but not exactly what i was looking for.

Here's my question;

I always wondered why you couldnt just click on the newstitle of an article posted on the homepage (index), just like most websites/blogs out there work.

You can only click on the 'Comments' or 'Read More' link at the bottom of the article (headline), at least in php-nuke 7.9 which im running.


I already made some changes in my theme.php, cause i couldnt find any article title in the modules/News/index.php.

Added
Code:
$title = "<a href=\"modules.php?name=News&amp;file=article&amp;sid=$s_sid\">$title</a>";


To the themeindex() function. The link above was copied from modules/News/index.php at the 'Read More' function.

Problem is that it needs that $s_sid, and im not exactly sure how to include it?
Looks like i need to pull this from the db with one of those sql functions but my knowledge on that is just very limited.

So how can I make this work? Other (easier) solutions are welcome as well of course Cool


Edit: This is the 1st part of the sql query found in modules/News/index.php

Code:
$result = $db->sql_query("SELECT sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories $qdb $querylang ORDER BY sid DESC limit $storynum");

   while ($row = $db->sql_fetchrow($result)) {
      $s_sid = intval($row['sid']);
 
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 6383

PostPosted: Thu May 01, 2008 4:34 pm Reply with quote

I did this on my website - Only registered users can see links on this board! Get registered or login!

Let me check the themeindex function to see.

_________________
I google, therefore I exist...
Only registered users can see links on this board! Get registered or login!
 
View user's profile Send private message
kguske
PostPosted: Thu May 01, 2008 5:12 pm Reply with quote

Somewhere in function themeindex, add this:
Code:
  global $sid;

  $title = '<a href="modules.php?name=News&amp;file=article&amp;sid='.$sid.'">'.$title.'</a>';
 
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6792
Location: Ha Noi, Viet Nam

PostPosted: Fri May 02, 2008 8:28 am Reply with quote

warren-the-ape - In an ideal world, you want to separate data from visual layout so with that in mind, it would IMHO be better to modify News/index.php rather than the theme.
The topic title is held in the var $title within index.php which you can see if you look at the code you posted above in the 'while' loop.
If you look at my site as an example, I have included text as well as the topic title in the ALT and TITLE html tags (I'm actually using images not text links).
 
View user's profile Send private message Send e-mail
kguske
PostPosted: Fri May 02, 2008 9:28 am Reply with quote

Confused...this is a visual layout issue - some may not want to have this presented this way. I'd say leave this in the theme.
 
Guardian2003
PostPosted: Fri May 02, 2008 10:57 am Reply with quote

Oops sorry. Yes I see you are wanting the article title as the link anchor text instead of 'Readmore' or 'Comments' I mis-read the post.
 
warren-the-ape
PostPosted: Sun May 11, 2008 6:40 am Reply with quote

Sorry for the late response, posted this topic just before i went on vacation Embarassed

But many thanks for the help and replies, it seems I was pretty close, looking at your code kguske Razz What you have on nukeseo.com is exactly what I had in mind, great stuff.

@ Guardian2003
Yep yep I know Cool, but my php knowledge is still very limited + im only using 1 theme on my site so dont think it would be a big problem.

Btw, i dont want to remove the 'readmore' and 'comments' links, just want to make a link out of the article title as well, mostly out of SEO purposes and cause its easier the click.

@ kguske
Could you explain the dots '.' around those variables (f.e. '.$sid.')? Is that necessary in PHP or just to make it php compliant? Me = still learning
 
warren-the-ape
PostPosted: Sun May 11, 2008 6:54 am Reply with quote

Hmm, it doesn't seem to work as it should be.

Im still getting the following link for all my articles; Only registered users can see links on this board! Get registered or login!

So its still missing that 'sid' nmbr.


This is the entire function, there was already a 'global' so i placed the '$sid' there, not sure if thats correct?

Code:


/************************************************************/
/* Function themeindex()                                    */
/*                                                          */
/* This function format the stories on the Homepage         */
/************************************************************/

function themeindex ($aid, $informant, $time, $title, $counter, $topic, $thetext, $notes, $morelink, $topicname, $topicimage, $topictext) {
    global $anonymous, $sid, $tipath;
    if ($notes != "") {
   $notes = "<br><br><b>"._NOTE."</b> <i>$notes</i>\n";
    } else {
   $notes = "";
    }
    if ("$aid" == "$informant") {
   $content = "$thetext$notes\n";
    } else {
   if($informant != "") {
       $content = "<a href=\"modules.php?name=Your_Account&amp;op=userinfo&amp;username=$informant\">$informant</a> ";
   } else {
       $content = "$anonymous ";
   }
   $content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
    }
    $title = '<a href="modules.php?name=News&amp;file=article&amp;sid='.$sid.'">'.$title.'</a>';
    $posted = ""._POSTEDBY." ";
    $posted .= get_author($aid);
    $posted .= " "._ON." $time $timezone ($counter "._READS.")";
    $tmpl_file = "themes/*/story_home.html";
    $thefile = implode("", file($tmpl_file));
    $thefile = addslashes($thefile);
    $thefile = "\$r_file=\"".$thefile."\";";
    eval($thefile);
    print $r_file;
}
 
kguske
PostPosted: Fri May 16, 2008 1:32 pm Reply with quote

OK, so I downloaded 7.9 and verified that the variable you need to use is $s_sid instead of $sid. Replace that in the global statement and in the link in this function, and it should work correctly.

It's strange - the link still has sid = $s_sid... So don't change your link - just the variable ($sid -> $s_sid).

ALSO, in function theindex in modules/News/index.php, add $s_sid to the global variable declaration statement.
 
warren-the-ape
PostPosted: Fri May 16, 2008 2:00 pm Reply with quote

Aaah many thnx for your help and time kguske, it worked Groovy

Could/should have seen that 's with underscore', its indeed already there in the modules/News/index.php Embarassed

I changed the $sid into $s_sid at the 'Function themeindex()' like you said + added the global statement in the News/index.php.

I really love it Cool It are the little things.
 
kguske
PostPosted: Sat May 17, 2008 5:10 am Reply with quote

RavensScripts
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©