1
aberdeenman
News Module Hack to Display Expiration Date
  • 2012/1/31 18:22

  • aberdeenman

  • Just popping in

  • Posts: 6

  • Since: 2012/1/31


I'd like to add the expiration date to the presentation of a news item.

I'm using Xoops 2.5.4 with the packaged news module and would like to avoid a core hack if possible, however I expect I'll need to do it since I don't see a call to the database value.

So maybe a better question would be how do you add a class (?) to an existing array?

I apologize if I'm using those terms incorrectly, I tend to hack-and-slash with machete first, then with dictionary if that doesn't work.

2
Mamba
Re: News Module Hack to Display Expiration Date
  • 2012/2/3 13:24

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Since News module shows the expiration date in the Admin mode, then you should be able to find the "expiration date" variable, and change the appropriate template to show expiration date for the users as well by using this variable.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

3
aberdeenman
Re: News Module Hack to Display Expiration Date
  • 2012/2/3 13:31

  • aberdeenman

  • Just popping in

  • Posts: 6

  • Since: 2012/1/31


Thanks Mamba I'm also going to look at backendt.php and see if I can tell how they're pulling it there. - I just didn't want to add it to the array and break something else because it becomes the Nth item pulled from the database.

4
aberdeenman
Re: News Module Hack to Display Expiration Date
  • 2012/4/27 16:46

  • aberdeenman

  • Just popping in

  • Posts: 6

  • Since: 2012/1/31


Just to finish this topic so that others can use this tip here's what I did in the news_item.html template file:

/** I use IF statements to sort out my topics */
<{if $story.topic_title|strip_tags:false == "TOPIC I DON'T WANT TO MODIFY"}>

<{elseif 
$story.topic_title|strip_tags:false == "TOPIC TO MODIFY"}>
  <
span class="itemPostDate"><b>Effective Until 

/** I use $story.expired to pull the date from the section, then format it for manipulation */
/** If NO expiration date was set, the default value will end in "1969" */
   
<{if $story.expired|truncate:4:"" == "1969"}> Further Notice 

   
<{else}> 

/** By this time we know there is an expiration date, now lets format and output it to the template */
   
<{$story.expired|date_format:"%A, %B %e %Y"}></b>
   <{/if}>
  </
span
<{/if}>

Login

Who's Online

201 user(s) are online (131 user(s) are browsing Support Forums)


Members: 0


Guests: 201


more...

Donat-O-Meter

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

Latest GitHub Commits