1
tatane
xo-banner for the module News
  • 2011/1/7 18:08

  • tatane

  • Just can't stay away

  • Posts: 649

  • Since: 2008/5/6 1


Hello

I want to display a different banner for the News module. So I modified a theme from template zetagenesis. In the template xobanner.html I've placed the code below

<{if  $xoops_dirname =="system"}> 
<
div id="xo-banner" class="<{$xoops_dirname}>">
    <
a href="<{xoAppUrl /}>"><img src="<{xoImgUrl img/heade.png}>" alt="<{$xoops_sitename}>" />a>
    <
a id="xo-main-logo" href="<{xoAppUrl /}>modules/xdonations"><img src="<{xoImgUrl img/header-logo.png}>" alt="<{$xoops_sitename}>" />a>
div>
<{/if}>

<{if  
$xoops_dirname =="liaise"}> 
<
div id="xo-banner" class="<{$xoops_dirname}>">
    <
a href="<{xoAppUrl /}>"><img src="<{xoImgUrl img/heade.png}>" alt="<{$xoops_sitename}>" />a>
    <
a id="xo-main-logo" href="<{xoAppUrl /}>modules/xdonations"><img src="<{xoImgUrl img/header-logo.png}>" alt="<{$xoops_sitename}>" />a>
div>
<{/if}>

<{if  
$xoops_dirname =="evennews"}> 
<
div id="xo-banner" class="<{$xoops_dirname}>">
    <
a href="<{xoAppUrl /}>"><img src="<{xoImgUrl img/heade.png}>" alt="<{$xoops_sitename}>" />a>
    <
a id="xo-main-logo" href="<{xoAppUrl /}>modules/xdonations"><img src="<{xoImgUrl img/header-logo.png}>" alt="<{$xoops_sitename}>" />a>
div>
<{/if}>

<{if  
$xoops_dirname =="mytube"}> 
<
div id="xo-banner" class="<{$xoops_dirname}>">
    <
a href="<{xoAppUrl /}>"><img src="<{xoImgUrl img/heade.png}>" alt="<{$xoops_sitename}>" />a>
    <
a id="xo-main-logo" href="<{xoAppUrl /}>modules/xdonations"><img src="<{xoImgUrl img/header-logo.png}>" alt="<{$xoops_sitename}>" />a>
div>
<{/if}>

<{if  
$xoops_dirname =="pm"}> 
<
div id="xo-banner" class="<{$xoops_dirname}>">
    <
a href="<{xoAppUrl /}>"><img src="<{xoImgUrl img/heade.png}>" alt="<{$xoops_sitename}>" />a>
    <
a id="xo-main-logo" href="<{xoAppUrl /}>modules/xdonations"><img src="<{xoImgUrl img/header-logo.png}>" alt="<{$xoops_sitename}>" />a>
div>
<{/if}>

<{if  
$xoops_dirname =="profile"}> 
<
div id="xo-banner" class="<{$xoops_dirname}>">
    <
a href="<{xoAppUrl /}>"><img src="<{xoImgUrl img/heade.png}>" alt="<{$xoops_sitename}>" />a>
    <
a id="xo-main-logo" href="<{xoAppUrl /}>modules/xdonations"><img src="<{xoImgUrl img/header-logo.png}>" alt="<{$xoops_sitename}>" />a>
div>
<{/if}>

<{if  
$xoops_dirname =="publisher"}> 
<
div id="xo-banner" class="<{$xoops_dirname}>">
    <
a href="<{xoAppUrl /}>"><img src="<{xoImgUrl img/heade.png}>" alt="<{$xoops_sitename}>" />a>
    <
a id="xo-main-logo" href="<{xoAppUrl /}>modules/xdonations"><img src="<{xoImgUrl img/header-logo.png}>" alt="<{$xoops_sitename}>" />a>
div>
<{/if}>

<{if  
$xoops_dirname =="xdonations"}> 
<
div id="xo-banner" class="<{$xoops_dirname}>">
    <
a href="<{xoAppUrl /}>"><img src="<{xoImgUrl img/heade.png}>" alt="<{$xoops_sitename}>" />a>
    <
a id="xo-main-logo" href="<{xoAppUrl /}>modules/xdonations"><img src="<{xoImgUrl img/header-logo.png}>" alt="<{$xoops_sitename}>" />a>
div>
<{/if}>

 <{if  
$xoops_dirname =="news"}>   
               <
div id="xo-banner2">
    <
a href="<{xoAppUrl /}>"><img src="<{xoImgUrl img/Bandeau-blog.jpg}>" alt="<{$xoops_sitename}>" />a>
    <
a id="xo-main-logo2" href="<{xoAppUrl /}>modules/xdonations"><img src="<{xoImgUrl img/header-logo.png}>" alt="<{$xoops_sitename}>" />a>
div>
  <{/if}>


It works fine, the problem is that I wanted to know if the code was clean and then if there were an easier way to use the News module

Thank you

2
Mamba
Re: xo-banner for the module News
  • 2011/1/8 16:29

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Just looking at that, it seems like you could shorten it, but saying something like:

if News
then this banner
else
the other banner

so you don't have to list all the non-News banners.

Unless I am missing something here and you want eventually specify a different banner for each of the individual modules.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

3
tatane
Re: xo-banner for the module News
  • 2011/1/8 17:28

  • tatane

  • Just can't stay away

  • Posts: 649

  • Since: 2008/5/6 1


I managed to do what I wanted but in a different way. I'll explain. In the file there xobanner.html code

<div id="xo-banner" class="<{$xoops_dirname}>">


So I created a class # xo-banner.news module for my news and new a new div for xo-main-logo and it works flawless



<{$xoops_sitename}>


<{if $xoops_dirname =="news"}>

<{$xoops_sitename}>

<{/if}>




css :

#xo-banner.news {
clear: both;
/* Use relative pos to ensure the banner ad img/flash is relative to the header */
position: relative;
z-index: 100;
width: 100%;
height: 160px;
background:#FFF url(../img/Bandeau-blog.jpg) repeat-x left bottom;
color: #7BADEA;
}

#xo-banner {
clear: both;
/* Use relative pos to ensure the banner ad img/flash is relative to the header */
position: relative;
z-index: 100;
width: 100%;
height: 160px;
background:#FFF url(../img/header-bg.png) repeat-x left bottom;
color: #7BADEA;
}

#xo-main-logo {
float: right;
}

#xo-main-logo2 {
float: right;
position: relative;
margin-top: -160px;
}





Login

Who's Online

246 user(s) are online (104 user(s) are browsing Support Forums)


Members: 0


Guests: 246


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