Author |
Message |
warren-the-ape
Worker
Joined: Nov 19, 2007
Posts: 196
Location: Netherlands
|
Posted:
Thu May 01, 2008 1:21 pm |
|
Ey guys,
Thought i'd might drop by again
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&file=article&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
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']);
|
|
|
|
|
|
kguske
Site Admin
Joined: Jun 04, 2004
Posts: 6434
|
Posted:
Thu May 01, 2008 4:34 pm |
|
|
|
|
kguske
|
Posted:
Thu May 01, 2008 5:12 pm |
|
Somewhere in function themeindex, add this:
Code: global $sid;
$title = '<a href="modules.php?name=News&file=article&sid='.$sid.'">'.$title.'</a>';
|
|
|
|
|
|
Guardian2003
Site Admin
Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam
|
Posted:
Fri May 02, 2008 8:28 am |
|
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). |
|
|
|
|
kguske
|
Posted:
Fri May 02, 2008 9:28 am |
|
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
|
Posted:
Fri May 02, 2008 10:57 am |
|
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
|
Posted:
Sun May 11, 2008 6:40 am |
|
Sorry for the late response, posted this topic just before i went on vacation
But many thanks for the help and replies, it seems I was pretty close, looking at your code kguske What you have on nukeseo.com is exactly what I had in mind, great stuff.
@ Guardian2003
Yep yep I know , 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
|
Posted:
Sun May 11, 2008 6:54 am |
|
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&op=userinfo&username=$informant\">$informant</a> ";
} else {
$content = "$anonymous ";
}
$content .= ""._WRITES." <i>\"$thetext\"</i>$notes\n";
}
$title = '<a href="modules.php?name=News&file=article&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
|
Posted:
Fri May 16, 2008 1:32 pm |
|
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
|
Posted:
Fri May 16, 2008 2:00 pm |
|
Aaah many thnx for your help and time kguske, it worked
Could/should have seen that 's with underscore', its indeed already there in the modules/News/index.php
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 It are the little things. |
|
|
|
|
kguske
|
Posted:
Sat May 17, 2008 5:10 am |
|
|
|
|
|