11
patagon
Re: Is there a TOP PAGE smarty identifier?
  • 2007/2/8 12:49

  • patagon

  • Quite a regular

  • Posts: 235

  • Since: 2002/1/8 0


blueteen,

could your solution work if there is no module for the start page?

also, I cant believe there isnt a built in solution for something like this, but I started a similar trhead long time ago and came to the same conclusion...

12
blueteen
Re: Is there a TOP PAGE smarty identifier?
  • 2007/2/8 13:10

  • blueteen

  • Quite a regular

  • Posts: 379

  • Since: 2004/7/16


on a website without module for start page :

at the same place where your theme.html is located :

create a file "myfile.php"
if ($_SERVER['REQUEST_URI'] == "/" || $_SERVER['REQUEST_URI'] == "/index.php")
{
$this->assign('top_page''1');
}
else {
$this->assign('top_page''0');}
?>


edit your theme.html, and just after , add :
<{include_php file="$xoops_rootpath/themes/your_theme/myfile.php"}>


then use this code :
<{if $top_page == "1"}>
your code here
<{/if}>

13
fooups
Re: Is there a TOP PAGE smarty identifier?
  • 2007/2/8 15:12

  • fooups

  • Just popping in

  • Posts: 82

  • Since: 2004/1/12


Very interesting Blueteen

On my website, I use the following code added in the header.php file (yes, I know, hacking core files is not a good idea):

$toppage false;

    if (isset(
$xoopsModule) && is_object($xoopsModule)) {

        if (
preg_match("/index.php$/i"xoops_getenv('PHP_SELF')) && $xoopsConfig['startpage'] == $xoopsModule->getVar('dirname')) {

            
$toppage true;

        }

    } else {

        if (!empty(
$xoopsOption['show_cblock'])) {

            
$toppage true;

        }

    
$xoopsTpl->assign('xoops_istoppage',$toppage);

    }


So, in any theme.html file, I can use:

<{if $xoops_istoppage}>
some code here
<{/if}>


Cheers

14
patagon
Re: Is there a TOP PAGE smarty identifier?
  • 2007/2/8 15:19

  • patagon

  • Quite a regular

  • Posts: 235

  • Since: 2002/1/8 0


thanks blueteen!

I look forward to trying this (my test and only XOOPS site is down at the moment but I was looking for a better solution to my dirty hack for years

15
maxima
Re: Is there a TOP PAGE smarty identifier?
  • 2007/2/8 21:45

  • maxima

  • Not too shy to talk

  • Posts: 152

  • Since: 2006/3/4 4


Quote:

blueteen wrote:
my solution doesn't work ?


I didn't try your method as it went through many hoops which I am trying to avoid. Using
Quote:

<{if $xoops_pagetitle == "home"}>Do this<{/if}>
is as simple as I want it to be and it works ok but I am stuck using one word or statement, which is not so bad.

Thanks

16
ianez
Re: Is there a TOP PAGE smarty identifier?
  • 2007/2/14 10:15

  • ianez

  • Not too shy to talk

  • Posts: 188

  • Since: 2006/1/26


may be I did not read all the posts..
On some of my sites I use this code for inserting conditionals in the theme for the home, hope this 'll help
<{if $xoops_dirname == "system"}>Do this<{/if}>


Ian

17
optikool
Re: Is there a TOP PAGE smarty identifier?
  • 2007/12/5 18:11

  • optikool

  • Not too shy to talk

  • Posts: 154

  • Since: 2007/3/26


Hey ianez,

Thanks for the input. This code did exactly what I wanted!

Quote:

ianez wrote:
may be I did not read all the posts..
On some of my sites I use this code for inserting conditionals in the theme for the home, hope this 'll help
<{if $xoops_dirname == "system"}>Do this<{/if}>


Ian

Login

Who's Online

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


Members: 0


Guests: 230


more...

Donat-O-Meter

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

Latest GitHub Commits