1
n01un0
Sort Order By Date
  • 2008/7/22 14:25

  • n01un0

  • Quite a regular

  • Posts: 253

  • Since: 2005/10/9


Hey guys, the following is the block template from the eguide module I am using. I have tweaked it to make it a project and completion module for my company. The quesiton I have is, what do I need to change in the following block code to make it show and sort the items by date rather than last post.
<{if $block.categories}>
<
div><b><{$smarty.const._BLOCK_EV_CATEGORY}></b>
  <{foreach 
from=$block.categories key=catid item=cat name=categ}>
    <
a href="<{$block.module_url}>/index.php?cat=<{$catid}>"><{$cat.name}></a><{if !$smarty.foreach.categ.last}>, <{/if}>
  <{/foreach}>
</
div>
<{/if}>
<{if 
$block.events}>
<{if 
$block.detail}> 
<{foreach 
item=event from=$block.events}>
<
div><{$event.date}>
   <
a href="<{$block.module_url}>/event.php?eid=<{$event.eid}><{if $event.exid}>&amp;sub=<{$event.exid}><{/if}>"><{$event.title}></a
   (<
a href="<{$xoops_url}>/userinfo.php?uid=<{$event.uid}>"><{$event.uname}></a> <{$event.post}>)
   <{
$event.mark}>
</
div>
<{/foreach}>
<{else}>
<{foreach 
item=event from=$block.events}>
<
div><{$event.date}>
  <
a href="<{$block.module_url}>/event.php?eid=<{$event.eid}><{if $event.exid}>&amp;sub=<{$event.exid}><{/if}>"><{$event.title}></a>
  <{
$event.mark}>
</
div>
<{/foreach}>
<{/if}>
<{else}>
<
div><{$smarty.const._BLOCK_EV_NONE}></div>
<{/if}>
<{if 
$block.waiting}>
<
p><a href="<{$block.module_url}>/admin/index.php?op=events"><{$smarty.const._BLOCK_EV_WAIT}></a>: <{$block.waiting}></p>
<{/if}>
<
div class="evmore"><a href="<{$block.module_url}>/"><{$smarty.const._BLOCK_EV_MORE}></a></div>

2
n01un0
Re: Sort Order By Date
  • 2008/7/24 12:12

  • n01un0

  • Quite a regular

  • Posts: 253

  • Since: 2005/10/9


anyone?

3
kerkyra
Re: Sort Order By Date
  • 2008/7/24 14:18

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


you will have to edit the php file and not the template
www.guidemap.gr - Beta is out...

4
n01un0
Re: Sort Order By Date
  • 2008/7/24 15:42

  • n01un0

  • Quite a regular

  • Posts: 253

  • Since: 2005/10/9


Well thats fine but which php file (I assume the block template php file) and what do I need to put?

5
kerkyra
Re: Sort Order By Date
  • 2008/7/25 14:02

  • kerkyra

  • Just can't stay away

  • Posts: 553

  • Since: 2005/2/14


there should be a blocks folder on the modules' directory! find the php file responsible for that block and identify the xoopsDB call that fetches the data of interest! in the end of it change the SORT BY dbtable to SORT BY date or whatever the name of the db column is! you can find the exact name from mysql.sql file in the sql folder of the module.
www.guidemap.gr - Beta is out...

6
mboyden
Re: Sort Order By Date
  • 2009/1/16 18:25

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


You no longer have to change the PHP code. I've posted information on how to sort an array in XOOPS/Smarty templates. I'll monitor that thread, but found this one while searching for a solution.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

Login

Who's Online

209 user(s) are online (139 user(s) are browsing Support Forums)


Members: 0


Guests: 209


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