1
unhookt
New template file for a module
  • 2007/10/11 16:07

  • unhookt

  • Just popping in

  • Posts: 5

  • Since: 2007/10/11


I would like to create a new html template for an existing module. I know that I can clone and edit existing template sets, but how do I add a template to an existing template set?

Why am I doing this?

The news module that I am using has a "main/index" page that creates a list of articles by including the "article" template in this way:

<{section name=i loop=$columns}>
<{foreach item=story from=$columns[i]}>
<{include file="db:news_item.html" story=$story}><{/foreach}>
<{/section}>

Because of the way the template "news-item.html" is styled, the main page that includes it is formatted badly. I don't want to change the "news-item.html" template styles because this template dictates how an individual article is displayed.

What I would like to do is create another template that uses different styling, call it "news_item2.html", add it to the existing set and then modify the "main" page so that it instead includes from the new template.

2
stefan88
Re: New template file for a module
  • 2007/10/11 16:46

  • stefan88

  • Community Support Member

  • Posts: 1086

  • Since: 2004/9/20


Hi,

look in xoops_version.php in module in question folder. Look for something like:

// Templates
$modversion['templates'][1]['file'] = 'news_item.html';
$modversion['templates'][1]['description'] = '';
$modversion['templates'][2]['file'] = 'news_archive.html';
$modversion['templates'][2]['description'] = '';
$modversion['templates'][3]['file'] = 'news_article.html';
$modversion['templates'][3]['description'] = '';
$modversion['templates'][4]['file'] = 'news_index.html';
$modversion['templates'][4]['description'] = '';
$modversion['templates'][5]['file'] = 'news_by_topic.html';
$modversion['templates'][5]['description'] = '';
...(
this is from News module)


..

3
unhookt
Re: New template file for a module
  • 2007/10/11 18:08

  • unhookt

  • Just popping in

  • Posts: 5

  • Since: 2007/10/11


Thanks. I ended up going to the MySQL database directly, but this is very helpful information.

What I did was go to the xoops_tplset table and insert a new row for the template that I created. Seems to work just fine.

Login

Who's Online

440 user(s) are online (103 user(s) are browsing Support Forums)


Members: 0


Guests: 440


more...

Donat-O-Meter

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

Latest GitHub Commits