1
Kumar
is_home ==1 and is_module=="modulename"
  • 2007/6/14 11:40

  • Kumar

  • Just popping in

  • Posts: 61

  • Since: 2005/8/8 1


How can i add two smarty variables that checks whether it is on home page or on a module page.
I have added the following code to header.php
le="color: #000000"><?php $xoopsTpl->assign( 'xoops_ishome', !empty($aggreg->blocks['page_topcenter']) || !empty($aggreg->blocks['page_topleft']) || !empty($aggreg->blocks['page_topright']) );

and placed $xoopsOption['ishome'] =1; in index.php. and used the following code in theme.html
le="color: #000000"><?php <{if $xoops_ishome ==1}> ...... <{/if}>

It worked fine but failed when there is call to header file from modules.

Is there any good solution to check this?
Thanks

2
rplima2004
Re: is_home ==1 and is_module=="modulename"
  • 2007/6/14 12:16

  • rplima2004

  • Just popping in

  • Posts: 70

  • Since: 2004/10/8


hi Kumar

I make this placing the code below in the end of the file header.php

le="color: #000000"><?php if (!strstr( $_SERVER['PHP_SELF'],'/modules/') || strstr( $_SERVER['PHP_SELF'],'/modules/') == ''){ if ($_SERVER['PHP_SELF'] == '/index.php' /*|| $_SERVER['PHP_SELF'] == '/sub_dir/index.php'*/){ //If your site is in a subdomain, uncomment the code to the side and changes the word "sub_dir" for the name of the directory where its site is #You are in home $xoopsTpl->assign( 'xoops_ishome', true ); }else{ #You aren't in home however isn't in no module $xoopsTpl->assign( 'xoops_ishome', false ); } }else{ #You are in some module $xoopsTpl->assign( 'xoops_ishome', false ); $xoopsTpl->assign( 'xoops_ismodule', true ); }


Make tests and sees if this helps you

[]s

3
Dave_L
Re: is_home ==1 and is_module=="modulename"
  • 2007/6/14 12:22

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


What about using
le="color: #000000"><?php <{$xoops_dirname}>
?

le="color: #000000"><?php <{if $xoops_dirname == 'system'}> ... in system module ... <{else}> ... in another module ... <{/if}>


You could parse
le="color: #000000"><?php <{$xoops_requesturi}>
if you need more specific information.

4
Kumar
Re: is_home ==1 and is_module=="modulename"
  • 2007/6/14 17:21

  • Kumar

  • Just popping in

  • Posts: 61

  • Since: 2005/8/8 1


Thank you verymuch rplima2004 & Dave_L for the quick and easy solution. Both methods works fine.

Who's Online

222 user(s) are online (183 user(s) are browsing Support Forums)


Members: 0


Guests: 222


more...

Donat-O-Meter

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

Latest GitHub Commits