1
studioC
Easteregg ... Playing with stylesheets ... and smarty engine
  • 2004/4/12 18:44

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


for those being boring after easter… or wanna have phun..

This is a small article which should help ending boring easterevenings. It shows in a very simple example, how to bring a little activity in your sites outfit using possible events or occasions smarty is teached to be able to react on.


!First !

As Always, making changes on your sites ... try this on your testsite first ...! then, please do change settings of your site in Admin ->System ->Preferenzes ->General Settings and turn "Debug mode" to "Smarty Templates Debug", click go! to save settings in database.

Viewing your homepage you will now see a new window with Smarty Debug Console where you find assigned template variables of the acual site for example
"{$xoops_isuser}"
which shows "1" cause i'm actual logged in ... sure you will get nothing "" if you are not logged in.

Knowing that we are allowed to use <{$xoops_isuser}> within theme we can now react on this "event".

This is one possible way to use this knowledge in theme.html:
<{if $xoops_isuser ==1}>
blabla

<{else}>
tralla tralla

<{/if}>


This is the second way which is called myEasterEgg in theme.html:

Using <{$xoops_isuser}> in theme.html will give us "1" for logged in and "" for not logged viewers of our site. Imagine you want to set different headerimages if a person is a logged in or not you will now get 2 different images event each ..using..

named : "headerimage1.gif" & "headerimage.gif".

The third way which is called myBigEasterEgg in theme.html:
As we are teached not to use that images in theme.html but within stylesheet we will make it noble way:

In theme.html:


and in stylesheet:

.headerimage {
background-image:url(../../themes/yourtheme/headerimage.gif);
width:200px;
height:100px;
}
.headerimage1 {
background-image:url(../../themes/yourtheme/headerimage1.gif);
width:200px;
height:100px;
}


This is just a small impression of how to begin playing with smarty engine. With this example you should be able to play with this at places in theme you want. Hu, .. load a different stylesheet for Admins , ..., using :


[of course you must have 2 stylsheets]..



and ... of course ... if Smarty Debug Console does not bring needed smarty .... ask in community if there is a hack or something you can use.. This is power of smarty template engine and xoops, .. just use it!
and now, ... let your head render this ... HAPPY EASTER !
Have Phun !

Michael

For those asking for a sense of this , .., I may have forgotten to place
<{$xoops_user_is_interested}>

2
ajaxbr
Re: Easteregg ... Playing with stylesheets ... and smarty engine
  • 2004/4/12 21:32

  • ajaxbr

  • Quite a regular

  • Posts: 276

  • Since: 2003/10/25


That's great, thanks a lot!
I guess someday I'll follow this way to include personal greetings, like "Welcome <{$xoops_username}>, you worthless freak"

3
studioC
Re: Easteregg ... Playing with stylesheets ... and smarty engine
  • 2004/4/13 14:56

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


thanks for reply ajax

This document was made to be [hopefully] helpful ..
greetings

michael

4
kahumbu
Re: Easteregg ... Playing with stylesheets ... and smarty engine
  • 2004/4/13 15:33

  • kahumbu

  • Documentation Writer

  • Posts: 277

  • Since: 2003/8/23


Your Easter Eggs are very nice! I'll bookmark this and try it out.

Thanks, studioC!

5
o0pk0o
Re: Easteregg ... Playing with stylesheets ... and smarty engine
  • 2004/4/30 23:44

  • o0pk0o

  • Just popping in

  • Posts: 20

  • Since: 2003/12/31


I just thought of a possible application of this for a XOOPS site that might want to have a splash page for users to log in at before they're presented with the main content. Or something like that.

<{if $xoops_isuser ==1}>

-- your theme html here --

<{else}>

-- splash html including log-in code --

<{/if}>

Haven't tried this out yet, but I guess now I have a project for the weekend.

6
ladon
Re: Easteregg ... Playing with stylesheets ... and smarty engine
  • 2004/5/1 0:09

  • ladon

  • Quite a regular

  • Posts: 284

  • Since: 2003/10/31


Might be nice to add something i've done. My theme.html is very small. I only use it to look at the module in use and then include a .html file for that module. And ofcourse, when needed, a .html uses its own .css.

The theme.html look something like this:
<{if $xoops_pagetitle == Forum}>
    <{include 
file="themedir/themeforum.html"}>
<{/if}>
<{if 
$xoops_pagetitle == TESTING}>
    <{include 
file="themedir/thememain.html"}>
<{/if}>
<{if 
$xoops_pagetitle == News}>
    <{include 
file="themedir/themenews.html"}>
<{/if}>


the included themes are the full theme files. In this case the themeforum.html displays only a few things: the content. I removed all blocks and tables except for header and footer (for banners and stuff).

This could be usefull when using (for example) the latest news items block. You want to show it on all pages except forum. Just selecting all modules except forum won't do, because then the block won't be shown when using pages like PM or login. This way you can just set the block to "all pages" and still not let it show at forums (or however you want it).

It's very likely that this is already documented somewhere (forums mayby), but I thought I'd share it for those who don't know this.

7
studioC
Re: Easteregg ... Playing with stylesheets ... and smarty engine
  • 2004/5/2 20:37

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


thanks again for replies....
you see how we can play with these smarty tags. There will be some other nice examples we actually gather...

and there are many smarty we can use. If there occurs a problem that you won't find a smarty fitting for special use... [and coders are busy ....]
use smarty custom functions to create your own ...
<{assign var="name" value="VarValue"}> ...
and use <{$name}> in theme or for themestuff ..

have phun
michael

Login

Who's Online

143 user(s) are online (81 user(s) are browsing Support Forums)


Members: 0


Guests: 143


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