21
Feichtl
Re: place div on homepage only
  • 2012/9/3 9:10

  • Feichtl

  • Not too shy to talk

  • Posts: 126

  • Since: 2004/11/8


@irmtfan:
<{if $smarty.const.XOOPS_STARTPAGE_REDIRECTED==}>

works perfect! Thx for the detailed explanation!

22
irmtfan
Re: place div on homepage only
  • 2012/9/4 4:00

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


XOOPS_STARTPAGE_REDIRECTED == 1 just show that you set a module for homepage in system -> general setting

Therefore if you dont set a module for homepage you should use something like $xoops_dirname == 'system'

but $SCRIPT_NAME == '/index.php' is a smarty that just show you are in index.php of the website. It is perfect because it is a CMS independent smarty that will definitely work in any xoops from 2.x versions and 2.6 2.7 and 3.0 and any other versions in the future.

23
sova
Re: place div on homepage only
  • 2012/9/9 3:12

  • sova

  • Not too shy to talk

  • Posts: 149

  • Since: 2010/4/13


I have this code:
if (defined("XOOPS_STARTPAGE_REDIRECTED") || (isset($GLOBALS['xoopsOption']['template_main']) && $GLOBALS['xoopsOption']['template_main'] == "db:system_homepage.html")) {
            if (
is_object($GLOBALS['xoopsTpl'])) {
                
$GLOBALS['xoopsTpl']->assign('homepage' ,true);
            }
        }

The code in the module system:
function eventCoreHeaderAddmeta($args)
    {
        if (!empty(
$_SESSION['redirect_message'])) {
            if (
defined("XOOPS_STARTPAGE_REDIRECTED") || (isset($GLOBALS['xoopsOption']['template_main']) && $GLOBALS['xoopsOption']['template_main'] == "db:system_homepage.html")) {
            if (
is_object($GLOBALS['xoopsTpl'])) {
            
$GLOBALS['xoopsTpl']->assign('homepage' ,true);
            
$GLOBALS['xoTheme']->addStylesheet('xoops.css');
            
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/jquery.js');
            
$GLOBALS['xoTheme']->addScript('browse.php?Frameworks/jquery/plugins/jquery.jgrowl.js');
            
$GLOBALS['xoTheme']->addScript('', array('type' => 'text/javascript'), '
            (function($){
                $(document).ready(function(){
                $.jGrowl("' 
$_SESSION['redirect_message'] . '", {  life:3000 , position: "center", speed: "slow" });
            });
            })(jQuery);
            '
);
        }
    }
                }
        }

And I used this code in the theme
<div id="news_box">
        <{if 
$homepage}>
        <
td>test</td>
        <{/if}>
        </
div>

But it does not work

---------------------
I used this code
<{if $SCRIPT_NAME == '/index.php' }>  
<
div id="news_box">
        <
td>test</td>
        </
div
<{/if}>

And
<{if $xoops == '/index.php' }>  
<
div id="news_box">
        <
td>test</td>
        </
div
<{/if}>

But this code does not work

24
irmtfan
Re: place div on homepage only
  • 2012/9/9 4:13

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


this must work:
<{if $SCRIPT_NAME == '/index.php' }>  
<
div id="news_box">
        <
td>test</td>
        </
div
<{/if}>


And if you have a subdomain you should add that.
<{if $SCRIPT_NAME == '/SUB_FOLDER/index.php' }> 
This is your website www.yoursite.com => <{$xoops_url}><br/>
<{/if}>



Login

Who's Online

171 user(s) are online (120 user(s) are browsing Support Forums)


Members: 0


Guests: 171


more...

Donat-O-Meter

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

Latest GitHub Commits