1
liomj
How do i check a xoops smarty plugin exist ?
  • 2022/10/2 13:23

  • liomj

  • Just popping in

  • Posts: 73

  • Since: 2012/4/10


Hi

How do i check the xoops smarty plugin exist or not before display ?

Quote:
<{if xoStats}}>

<{xoStats}>
Latest Member : <a href="<{$xoops_url}>/userinfo.php?uid=<{$latestUid}>"><{$latestMemberUname}></a><br>
Total Posts : <{$totalPosts}><br>
Total Users : <{$totalUsers}><br>
Total Online : <{$totalOnline}><br>
New Users Today : <{$newUsersToday}><br>
New Users Yesterday : <{$newUsersYesterday}><br>
<{/if}>

i tried like the above but i received smarty error when the plugin does not exist

2
goffy
Re: How do i check a xoops smarty plugin exist ?
  • 2022/10/2 15:46

  • goffy

  • Just can't stay away

  • Posts: 512

  • Since: 2010/12/27


try

<{if xoStats|default:false}>

3
liomj
Re: How do i check a xoops smarty plugin exist ?
  • 2022/10/2 22:32

  • liomj

  • Just popping in

  • Posts: 73

  • Since: 2012/4/10


<{if xoStats|default:false}>
Quote:
Error: Smarty error: [in sbadmin/tpl/content.tpl line 2]: syntax error: unidentified token ':false' (Smarty_Compiler.class.php, line 1410) in file /class/smarty/Smarty.class.php line 1099


<{if xoStats}>
Quote:
Error: Smarty error: [in sbadmin/tpl/content.tpl line 3]: syntax error: unrecognized tag 'xoStats' (Smarty_Compiler.class.php, line 585) in file /class/smarty/Smarty.class.php line 1099

4
Mamba
Re: How do i check a xoops smarty plugin exist ?
  • 2022/10/3 20:41

  • Mamba

  • Moderator

  • Posts: 11277

  • Since: 2004/4/23


You could also check in the PHP if the plugin exists and then assign a value to it. Maybe something like this:
$xoStatsExists file_exists(XOOPS_ROOT_PATH'/class/smarty/xoops_plugins/function.xoStats.php');
$xoopsTpl->assign('xoStatsExists'$xoStatsExists );
And then in the template:
<{if $xoStatsExists }>
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

5
liomj
Re: How do i check a xoops smarty plugin exist ?
  • 2022/10/4 9:58

  • liomj

  • Just popping in

  • Posts: 73

  • Since: 2012/4/10


thank you Mamba. i think that should work but im not sure which php file should i put it if the <{xoStats}> is in the themes template

6
Mamba
Re: How do i check a xoops smarty plugin exist ?
  • 2022/10/6 5:27

  • Mamba

  • Moderator

  • Posts: 11277

  • Since: 2004/4/23


I don't think that you actually have to test it, if this is on a website that you manage. Just make sure that the plugin is uploaded there, and you're done, and there will be no error.

If you want to make it available for people to download, then just add info in the README file that they have to upload the plugin, similar to how it was done in the TdmStats module. If people don't do it and then complain, you can point to the Readme file and the info there.

Am I missing something?
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

7
liomj
Re: How do i check a xoops smarty plugin exist ?
  • 2022/10/6 13:30

  • liomj

  • Just popping in

  • Posts: 73

  • Since: 2012/4/10


Yes thank you adding info in a readme file will be sufficient

Login

Who's Online

74 user(s) are online (52 user(s) are browsing Support Forums)


Members: 0


Guests: 74


more...

Donat-O-Meter

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

Latest GitHub Commits