[solved]Site header question

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
EoinDubh
Forum Members
Forum Members
Posts: 34
Joined: Sun Feb 28, 2010 12:52 am

[solved]Site header question

Post by EoinDubh »

I am migrating a site from phpWebsite to CMSMS. The original site is at http://sstsng.com/.
If you look at the site and refresh the page you will notice that the photo changes with each refresh. The new site is at http://sstsmg.com.sscms/ and I would like to be able to do the same thing with this site. However I am having trouble getting it to work. I am fairly good with html, php and css but have not worked much with smarty before. It seems that wherever I place the code it has no effect on the page. The code from the old site is

Code: Select all

</__body>

<a href="."></a>
<table>
<tr><td><img src="{THEME_DIRECTORY}/images/poweredby.jpg" alt="SSTS logo" border="0" />
</td><td><img src="{THEME_DIRECTORY}/images/spacer_100px.jpg" alt="spacer" border="0" />
</td><td>
<img src="{THEME_DIRECTORY}images/header/rotator.php" align="middle" alt="Auto Images" />
</td><td><h2>The Sorry Safari Touring Society</h2><br /><h3> - A gathering of MG enthusiasts</h3></td></tr>
</table>
I would guess that it should go in the defaultTheme.php for the site in this section

Code: Select all

{
	echo '<div><p class="logocontainer"><img src="themes/default/images/logo.gif" alt="" /><span class="logotext">'.lang('adminpaneltitle').' - '. $this->cms->siteprefs['sitename'] .'    '.lang('welcome_user').': '.$this->cms->variables['username'].'</span></p></div>';
        echo "<div class=\"topmenucontainer\">\n\t<ul id=\"nav\">";
        foreach ($this->menuItems as $key=>$menuItem) {
        	if ($menuItem['parent'] == -1) {
        	    echo "\n\t\t";
        		$this->renderMenuSection($key, 0, -1);
        	}
        }
bui I have not been able to get it working so far.

Any suggestions?
Last edited by EoinDubh on Sun Oct 17, 2010 1:59 pm, edited 1 time in total.
Peciura

Re: Site header question

Post by Peciura »

Personally i store own themes on "/uploads/themes". In your case it could look like this

Code: Select all

{root_url}/uploads/themes/default/images/logo.gif
For logo i would use CSS:

Code: Select all

<a id='logo' title='{sitename}'/>

Code: Select all

a#logo{
position:absolute;
top:148px;
left:165px;
z-index:-5;
color:#FFF;
background: transparent url(/uploads/themes/default/images/logo.gif) no-repeat scroll -318px -211px;
width:250px;
height:250px;
}
Do not forget you can use smarty in CSS if needed
background: transparent url([[root_url]]/uploads/themes/default/images/logo.gif)
uniqu3

Re: Site header question

Post by uniqu3 »

For the random image you could use something like this in your Template "Layout->Template->Yout Template"
{math equation='rand(1,5)' assign="imgnumber"} {*calculating numbers from 1 to 5 *}
{assign var="random_image" value="uploads/yourtemplate/yourimagename`$imgnumber`.jpg"} {* adds the random number to the image name *}
And where image should be displayed:
or simply:
And in your /uploads/yourtemplate folder you simply save images like:
yourimagename1.jpg
yourimagename2.jpg
yourimagename3.jpg
Last edited by uniqu3 on Mon Sep 27, 2010 8:36 am, edited 1 time in total.
EoinDubh
Forum Members
Forum Members
Posts: 34
Joined: Sun Feb 28, 2010 12:52 am

Re: Site header question

Post by EoinDubh »

For the site that I posted about, we decided to go ahead with the updated site without the changing graphics. However, as I have several sites that I am moving to CMSMS, the same issue exists with a couple of them.

I think that I was not clear enough in my question. I have the logo working. That was easy. What I am having trouble with is the second part of the header which is most easily explained by looking at the site that I am converting. It is at http://clan-donald-usa.org and it places a photo at the top right of each page that changes every time the page is refreshed. The code that does this is:

Code: Select all

<img src="{THEME_DIRECTORY}images/header/rotator.php" align="middle" alt="Clan Donald Images" />
. I realize that the path needs to change as it is from the old site. In the header directory are the photos and some javascript which changes the images randomly. If you look at the new site http://clan-donald-usa.org/CDCMS/ you will see the logo at the left and the site name graphic to the right. Where I am having trouble is in where to put the code to display the images.

Thanks
Peciura

Re: Site header question

Post by Peciura »

The easiest way was just described by uniqu3.
Other options is to use image rotator plugin (there are some of them on forge), like "Random Image Selector" or even modules like Gallery or Album.

I could only extend Uniqu3 template. In this template you do not need to rename files  on directory.
{assign var='header_images' value='uploads/relative/path/to/header/images/*.*'|glob}
{capture assign='equation'}rand(0,{$header_images|@count}-1){/capture}
{math equation=$equation assign='imgnumber'}
{if !empty($header_images)}

{/if}
spcherub
Power Poster
Power Poster
Posts: 402
Joined: Fri Jun 06, 2008 5:54 pm

Re: Site header question

Post by spcherub »

I second (third?) the suggestions made by the previous responders. Now that you are working within the CMSMS framework, you should try and use existing extensions and modules that can do what you need, instead of relying on your own, stand-alone scripts. Of course, if you don't find a module, extension or workaround that meets your need, you could write one, but it should be done using the guidelines for working within the framework.

If you still want to use your rotator.php script you will need to put it outside the CMSMS /uploads directory. So if CMSMS runs from /cms/ then create a folder /cms/custom and copy your script here, and make sure to update references (within the script) to source images as necessary. Then update your calls in your template to say src="/custom/rotator.php".

This way you can run your custom script and also protect it from being inadvertently clobbered during a future upgrade.

But... try to get this done using standard methods outlined by other posters first, before resorting to your custom script.

Hope that helps.

Sanjay
EoinDubh
Forum Members
Forum Members
Posts: 34
Joined: Sun Feb 28, 2010 12:52 am

Re: [solved]Site header question

Post by EoinDubh »

Thanks for the pointers. I am working on trying to get up to speed on the way that the framework functions. For now I am using just plain text but am also working on usint existing modules to accomplish what I want to do.
Post Reply

Return to “Layout and Design (CSS & HTML)”