11
LazyBadger
Re: Include a block in a theme

It doesn't solve needed porblem
Mixing PHP and Smarty in theme - bad style of coding (from my POV), because it destroy main principle "Separation business-logic from presentation"
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

12
stefan88
Re: Include a block in a theme
  • 2005/8/2 19:34

  • stefan88

  • Community Support Member

  • Posts: 1086

  • Since: 2004/9/20


It does solve the problem (as I understand it - to have a permanent login in theme) if it works, and it does :)

As for the style I agree, but didn't have the time to do it in diferent way. I think it could be done as smarty plugin as the "loading time/number of queries" hack, but I'm new to smarty and will have to read some docs before doing it.

Stefan

BTW: the PHP code is needed to display the number of mesages in Inbox, not for the login itself, so this part could be removed ...
..

13
thoughtscape
Re: Include a block in a theme

Thanks stefan. That's a neat piece of code. I struggle with the presentation layer problem. I don't want to include PHP code in my presentation layer. But it looks like that would be the best approach to pull in the language constants that I am looking for. That's really what this is about -- I'm hard-coding a login form into my theme but I would prefer it to be language independent.

Now that I think about it....and actually look through the XOOPS code, I think that you are right about a Smarty plugin. It should be relatively easy to write one that would retrieve a template by name.

That way we could include an arbitrary block template by invoking the plugin function with the template file name -- system_block_login.html for example -- as an argument. The plugin would pull the template of that name from XOOPS and insert it.

I guess that this is something that we should be bouncing around in the Smarty Help forum.

Thanks for your suggestions.

james

14
carnuke
Re: Include a block in a theme
  • 2005/8/3 18:54

  • carnuke

  • Home away from home

  • Posts: 1955

  • Since: 2003/11/5


Check out 7dana.com they have several XOOPS themes that include login and search in their theme.html files.

.
hhttp://houseofstrauss.co.uk Resource for alternative health and holistic lifestyle
search xoops

15
LazyBadger
Re: Include a block in a theme

No problem with embedding any block, main problem is transparent I18n'ion of included parts
Quis custodiet ipsos custodes?

Webmaster of
XOOPS2.RU
XOOPS Modules Proving Ground
XOOPS Themes Exhibition

16
shank
Re: Include a block in a theme
  • 2005/8/25 22:11

  • shank

  • Not too shy to talk

  • Posts: 144

  • Since: 2004/8/17


Quote:

LazyBadger wrote:
No problem with embedding any block, main problem is transparent I18n'ion of included parts


What is "I18n'ion"?

Stefan,

You could create a file in the class/smarty/plugins/ folder called insert.messages.php with this in it
function smarty_insert_pms()
{
GLOBAL 
$xoopsUser;
$pm_handler =& xoops_gethandler('privmessage');
$uid $xoopsUser->getVar('uid');
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
$criteria->add(new Criteria('to_userid'$uid));
$msgcount $pm_handler->getCount($criteria);
$GLOBALS['xoopsTpl']->assign('msgcount'$msgcount);
}
?>


Then erase your

Login

Who's Online

274 user(s) are online (210 user(s) are browsing Support Forums)


Members: 0


Guests: 274


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