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
$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
<{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

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
<{$xoops_dirname}>
?

<{if $xoops_dirname == 'system'}>
... 
in system module ...
<{else}>
... 
in another module ...
<{/if}>


You could parse
<{$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.

Login

Who's Online

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


Members: 0


Guests: 352


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