PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
warren-the-ape
Worker
Worker


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

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

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: 4853

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

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


Let me check the themeindex function to see.
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 4853

PostPosted: Thu May 01, 2008 5:12 pm Reply with quote Back to top

Somewhere in function themeindex, add this:
Code:
  global $sid;
  $title = '<a href="modules.php?name=News&amp;file=article&amp;sid='.$sid.'">'.$title.'</a>';
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 4824

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

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 Visit poster's website
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 4853

PostPosted: Fri May 02, 2008 9:28 am Reply with quote Back to top

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.
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 4824

PostPosted: Fri May 02, 2008 10:57 am Reply with quote Back to top

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.
View user's profile Send private message Send e-mail Visit poster's website
warren-the-ape
Worker
Worker


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

PostPosted: Sun May 11, 2008 6:40 am Reply with quote Back to top

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
View user's profile Send private message
warren-the-ape
Worker
Worker


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

PostPosted: Sun May 11, 2008 6:54 am Reply with quote Back to top

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 to the forums!


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;
}
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 4853

PostPosted: Fri May 16, 2008 1:32 pm Reply with quote Back to top

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.
View user's profile Send private message
warren-the-ape
Worker
Worker


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

PostPosted: Fri May 16, 2008 2:00 pm Reply with quote Back to top

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.
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 4853

PostPosted: Sat May 17, 2008 5:10 am Reply with quote Back to top

RavensScripts
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum