1
Kumar
Smarty function
  • 2008/3/12 8:29

  • Kumar

  • Just popping in

  • Posts: 61

  • Since: 2005/8/8 1


I want to know whether a string is there in a variable

<{if $xoops_requesturi 'contains' "storytopic"}>
do this..
<{/if}>

what function can i use instead on 'contains'?

Any solutions.

Thanks in Advance.

2
iHackCode
Re: Smarty function

searching in google i found this.
http://www.phpinsider.com/smarty-forum/viewtopic.php?=&p=39484

so try
<{if $xoops_requesturi|strstr:"storytopic"}>
...
<{/if}>

or

<{if $xoops_requesturi|eregi:"storytopic"}>
...
<{/if}>

.i havent tested it though.
[size=xx-small]my wamp died.[/size]
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

3
blueteen
Re: Smarty function
  • 2008/3/13 9:37

  • blueteen

  • Quite a regular

  • Posts: 379

  • Since: 2004/7/16


Hello, here's how i proceed to do something similar.

Create a new file "my_functions.php" in your theme folder.
Copy this code inside
<?php
if ($_SERVER['REQUEST_URI'] == "/modules/news/")
{
    
$this->assign('newsok''1');
}
?>

Then, in your theme, add this line, right under the body tag
<{include_php file="$xoops_rootpath/themes/YOUR_THEME_NAME/my_functions.php"}>


and you can now use this piece of code in your theme :
<{if $newsok == "1"}>
your code here
<{/if}>


I use this code too for personnal use
if (eregi('viewpmsg',$_SERVER['SCRIPT_NAME']) || eregi('readpmsg',$_SERVER['SCRIPT_NAME']))
{
    
$this->assign('messagerie''1');
}


So, for your question, I think that you can use this :

if (eregi('storytopic,$_SERVER['SCRIPT_NAME']))
{
    $this->assign('
storytopic', '1');
}


and in your theme
<{if $storytopic == "1"}>
your code here
<{/if}>


i'm using this, to display a custom block, only onhttp://www.website.fr/modules/news/ webpage.

and not onhttp://www.website.fr/modules/news/index.php?storytopic=12 for example.

Login

Who's Online

261 user(s) are online (185 user(s) are browsing Support Forums)


Members: 0


Guests: 261


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