1
philroy
Wfsection - each section link jump to most recent post?
  • 2004/1/25 3:20

  • philroy

  • Friend of XOOPS

  • Posts: 107

  • Since: 2003/8/23


Hi all,

http://www.pnins.school.nz/

This Schools web site uses Wfsections in the "Teams" area of the left-hand menu. At the moment, clicking on the names of any of the teams (the teams names are in Maori for anyone wondering) jumps to a list of the articles for that section....I want it to jump to the most recent posting in that section, particluarly because at the moment, there is only one posting per team.

I've searched the forums but haven't been able to find a solution. I want the link to always jump to the most recent posting for each section...how do I do it?

Cheers,

Phil

2
JackJ
Re: Wfsection - each section link jump to most recent post?
  • 2004/1/25 4:29

  • JackJ

  • Community Support Member

  • Posts: 747

  • Since: 2003/8/31


Hello there, very nice site.

I think you would really need a direct link to the article unless a coder can come up with some tricks.

The block WF-Section Recent Articles shows direct links to the article concerned, but the title of the article will appear in the block, not the team unless you rename the article to the name of the team.

Another way to go is create custom blocks with the hyperlinks showing the names of the teams--and direct links to the articles, the paths of course can be found in the browser address bar. To change the hyperlink for new articles is quite simple, you just change the article i.d part i.e.

http://www.pnins.school.nz/modules/wfsection/article.php?articleid=6

So first create the article, and find out its path from the browser address, and change the id part in the hyperlink in your custom block i.e.:

articleid=7


I have a wee bit about custom blocks on my site or post here if you need assistance.

There is also a block called "WF-Section Article Links" which you can activate. In each article you wish to appear in this block, put a tick in "no show article" box which is near the bottom when you edit the article--this moves the link to the "WF-Section Article Links" block (which you can re-name), and creates a direct link to the article. If you change the name of the article to the name of the team, this is what will appear in the link. Each New article with "no show article" activated will appear in this block. The article will not appear in other wfsection blocks while "no show article" is activated though.

3
philroy
Re: Wfsection - each section link jump to most recent post?
  • 2004/1/25 9:15

  • philroy

  • Friend of XOOPS

  • Posts: 107

  • Since: 2003/8/23


Thanks for your comments, but that won't solve the problem I think? Basically I need 5 links that will *always* jump to the most recent posting in each of the sections for a team in the school.

So regardless of whether one team has 5 postings and another team has 3, each link will always point to the most recent article *in that topic section*.

Quote:
Another way to go is create custom blocks with the hyperlinks showing the names of the teams--and direct links to the articles, the paths of course can be found in the browser address bar. To change the hyperlink for new articles is quite simple, you just change the article i.d part i.e.


Right...but every time a team places a new posting in their section, the link to the article become obsolete doesn't it, as it is no longer pointing to the most recent article?

Quote:
There is also a block called "WF-Section Article Links" which you can activate. In each article you wish to appear in this block, put a tick in "no show article" box which is near the bottom when you edit the article


Not edit the article...post new ones....this block would not keep a fine balance....I need it to pick one (the most recent) post from each topic/team area....not just the most recent postings from WFSections.

Phil

4
philroy
Re: Wfsection - each section link jump to most recent post?
  • 2004/1/29 3:45

  • philroy

  • Friend of XOOPS

  • Posts: 107

  • Since: 2003/8/23


Bump.
Anyone got a solution to this at all?

Cheers,

Phil

5
philroy
Re: Wfsection - each section link jump to most recent post?
  • 2004/2/15 3:16

  • philroy

  • Friend of XOOPS

  • Posts: 107

  • Since: 2003/8/23


Final bump (I promise)....anyone got a solution? Sorry for the bump, I'd just really like to solve this.

Phil

6
Catzwolf
Re: Wfsection - each section link jump to most recent post?
  • 2004/2/15 4:23

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


Ok I think I understand what you are looking for here.

You have four sections (in this case four different 'houses' within your school) and what you want is to take the most recent articles from each house and display them within an block? yes?

There are two ways you can do this:

First, you will have to modify the new articles block and create a loop around something like this:

function b_wfs_new_show($options)
{
global $xoopsDB;
$myts = &MyTextSanitizer :: getInstance();
$block = array();
$sql = "SELECT id, title FROM " . $xoopsDB -> prefix("wfs_category") . "";
list($category_id, $title) = $xoopsDB -> fetchrow($result);
$categorycount = $xoopsDB -> getRowsNum($result2);

for ($i = 0; $i < count($categorycount); $i++) {
$sql2 = "SELECT articleid, title, published, expired, counter, groupid FROM " . $xoopsDB -> prefix("wfs_article") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") AND noshowart = 0 AND offline = 0 ORDER BY " . $options[0] . " AND categoryid = " . $category_id . " DESC";
$result2 = $xoopsDB -> query($sql2, $options[1], 0);
while ($myrow = $xoopsDB -> fetchArray($result)) {
if (checkAccess($myrow["groupid"])) {
$wfs = array();
$title = $myts -> makeTboxData4Show($myrow["title"]);
if (!XOOPS_USE_MULTIBYTES) {
if (strlen($myrow['title']) >= $options[2]) {
$title = $myts -> makeTboxData4Show(substr($myrow['title'], 0, ($options[2] -1))) . "...";
}
}
$wfs['title'][$i] = $title;
$wfs['id'][$i] = $myrow['articleid'];
if ($options[0] == "published") {
$wfs['new'][$i] = formatTimestamp($myrow['published'], "s");
} elseif ($options[0] == "counter") {
$wfs['new'][$i] = $myrow['counter'];
}
$block['new'][$i][] = $wfs;
}
}
}
return $block;
}

(Not tested this but it should give you a few pointers on what should be done.

The other way would be to clone the wfs_new.php block for each category and change this line:

$sql = "SELECT articleid, title, published, expired, counter, groupid FROM " . $xoopsDB -> prefix("wfs_article") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") AND noshowart = 0 AND offline = 0 ORDER BY " . $options[0] . " DESC";

to

$sql = "SELECT articleid, title, published, expired, counter, groupid FROM " . $xoopsDB -> prefix("wfs_article") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") AND noshowart = 0 AND offline = 0 ORDER BY " . $options[0] . " AND categoryid = " . whatever categoryid you wish to use. " DESC";

Hope that helps in some way.


7
philroy
Re: Wfsection - each section link jump to most recent post?
  • 2004/2/15 8:12

  • philroy

  • Friend of XOOPS

  • Posts: 107

  • Since: 2003/8/23


Thanks for your comments. Basically I just want to make the links on the left for the teams in School to always jump to the most recent artcile for that team when clicked on. So if the kids in Arataki Team put a story up tomorrow, clicking on their name in the left menu of the site will jump to this (the most recent) story, rather than a generic list of articles available under that Team.

I'll go for your easiest suggestion I think (as I'm not that adept at understanding the first!)..."clone the wfs_new.php block"....but once I clone this file, what do I do with it? Is this what I make the links for each team load from the left menu?

Cheers,

Phil

8
Catzwolf
Re: Wfsection - each section link jump to most recent post?
  • 2004/2/15 14:00

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


I forgot, you will have to clone this in Xoops_version.php

ie

$modversion['blocks'][6]['file'] = "wfs_new1.php";
$modversion['blocks'][6]['name'] = _MI_WFS_BNAME5;
$modversion['blocks'][6]['description'] = "Shows recent articles";
$modversion['blocks'][6]['show_func'] = "b_wfs_new_show1";
$modversion['blocks'][6]['edit_func'] = "b_wfs_new_edit1";
$modversion['blocks'][6]['options'] = "published|10|19";
$modversion['blocks'][6]['template'] = $newartblock;

$modversion['blocks'][6]['file'] = "wfs_new2.php";
$modversion['blocks'][6]['name'] = _MI_WFS_BNAME5;
$modversion['blocks'][6]['description'] = "Shows recent articles";
$modversion['blocks'][6]['show_func'] = "b_wfs_new_show2";
$modversion['blocks'][6]['edit_func'] = "b_wfs_new_edit2";
$modversion['blocks'][6]['options'] = "published|10|19";
$modversion['blocks'][6]['template'] = $newartblock;

etc etc for each new block

then in each new wfs_new.php file change the function likewise.

Update the module and that should work, if not let me know and I will do it for you

9
philroy
Re: Wfsection - each section link jump to most recent post?
  • 2004/2/19 8:16

  • philroy

  • Friend of XOOPS

  • Posts: 107

  • Since: 2003/8/23


No, I'd have to admit to being fairly well lost. I've updated the code from your first posting....Quote:

The other way would be to clone the wfs_new.php block for each category and change this line:

$sql = "SELECT articleid, title, published, expired, counter, groupid FROM " . $xoopsDB -> prefix("wfs_article") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") AND noshowart = 0 AND offline = 0 ORDER BY " . $options[0] . " DESC";

to

$sql = "SELECT articleid, title, published, expired, counter, groupid FROM " . $xoopsDB -> prefix("wfs_article") . " WHERE published < " . time() . " AND published > 0 AND (expired = 0 OR expired > " . time() . ") AND noshowart = 0 AND offline = 0 ORDER BY " . $options[0] . " AND categoryid = " . whatever categoryid you wish to use. " DESC";


but am unsure what you meant by Quote:
AND categoryid = " . whatever categoryid you wish to use. " DESC";


I've then updated the Xoops_version.php file you suggest with your code, but the "b_wfs_new_show2" and "b_wfs_new_edit2" stuff just completely confuses me.

Then your comment...Quote:
then in each new wfs_new.php file change the function likewise

has got me stumped too.

I'm getting lost.

Phil

Login

Who's Online

255 user(s) are online (146 user(s) are browsing Support Forums)


Members: 0


Guests: 255


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits