| Re: Wfsection - each section link jump to most recent post? |
| by philroy on 2004/2/19 8:16:24 No, I'd have to admit to being fairly well lost. I've updated the code from your first posting....Quote:
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 |
| Re: Wfsection - each section link jump to most recent post? |
| by Catzwolf on 2004/2/15 14:00:08 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
|
| Re: Wfsection - each section link jump to most recent post? |
| by philroy on 2004/2/15 8:12:45 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 |
| Re: Wfsection - each section link jump to most recent post? |
| by Catzwolf on 2004/2/15 4:23:51 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. |
| Re: Wfsection - each section link jump to most recent post? |
| by philroy on 2004/2/15 3:16:55 Final bump (I promise)....anyone got a solution? Sorry for the bump, I'd just really like to solve this. Phil |