-
AuthorPosts
-
August 30, 2007 at 3:25 pm #122415
Hi All
I need help in setting the right header image.
On my business site we have assigned one image for one menu voice, but when we click to, say a product, we wish to make it show the same previous image.An example is worth a thousand words: go to http://www.archivist.it/Prodotti-Archivist/ and mind the header img; after clicking one of the products, the image changes and switches to sh01.jpg.
I wish to set it so that the header image for ALL products remains the same: any suggestions?Thanks anticipately.
September 1, 2007 at 2:15 am #228563I’m italian but I write in english so other people can understand.
Open the file index.php in /templates/ja_zibal
just a few line over <div id=”ja-sh” class=”clearfix” style=”background:url(<?php echo “$ja_template_path/images/$ja_color/$ja_headerimg”; ?>) no-repeat top right; “>
write:
<?php
if ($id>=1 and $id<=11)
$ja_headerimg=”sh03.jpg”;
?>That means that:
shows the image sh03.jpg for the id article between 1 to 11You can set a different range of number, you can use an array otherwise.
If you’ve only 5 articles and they’re sequentials use the syntax above, otherwise you can use this syntax:
…
if ($id=1 or $id=2 or $id=5 or $id=25 or $id=42)
…Italiano:
Puoi dirmi una cosa, usi SEF ADVANCE per caso oppure qualcos’altro?See you
CarloSeptember 3, 2007 at 8:17 am #228678For instance, I use SH404SEF. With SEO disabled the images works well, without code hacks.
I disabled SEO and tried your code:
<div id=”ja-sh” class=”clearfix”….”>
<?php
if ($id>=1 and $id<=11)
$ja_headerimg=”sh03.jpg”;
?>it does seem not to work.
So I tried to insert the following code in the place you specified:
<div id=”ja-sh” class=”clearfix”….”><?php
if ($id=23 && $Itemid=45) $ja_headerimg=”sh04.jpg”;
?>but I am still not able to see any change. How to reference the main Joomla variables? I’m trying id and itemid, but It seem I’m unable to reference to the right vars.
Addendum: this page : http://www.archivist.it/index.php?option=com_content&task=view&id=23&Itemid=45 is equal to this: http://www.archivist.it/Prodotti/Archivist.html
September 4, 2007 at 2:13 pm #228795The PHP code you must write before the background style setting.
Then you’ve to use == and not = in the if statement.You’ve to do so:
<?php
if ($id==23 && $Itemid==45)
$ja_headerimg=”sh04.jpg”;
?>and then write
<div id=”ja-sh” class=”clearfix”….”>
Otherwyse doesn’t work
Please let me know if the problem has been solved with this post.
Thank you for your suggestion about sh404SEF
September 5, 2007 at 12:49 pm #228881I’m sorry for my error.
I made the code corrections and I must thank you for your help.Although I must point out that it does work only if SEO is OFF.
If I activate SEO, nisba.
So it is unuseful if I ain’t able to have control over both aspects. Suggestions?— begin Italian unuseful comment
Quando si dice: Voglio la botte piena e la moglie ubriaca…
(Grazie per l’aiuto cmq)September 10, 2007 at 8:42 am #229187The solution in this case is get the REQUEST_URI value and with a IF statement show the appropriate image.
You have to show the image for example sh04.jpg when in the REQUEST_URI (part of the web url in the address bar) there are one of the following strings:
Prodotti-Archivist, Archivist.html, ArchiBOX.html, Conservazione-Sost.html, Digitalizzazione-C-Terzi.html, Stoccaggio.htmlAttention, we’re going to use a simple REGEX and YOU HAVE NOT sobstitute the character | with || between the page name must be only 1 | sign
Then between string and | sign must be not spaces
Please let me know if it’s ok
So you have to do:
[PHP]<?php
if (eregi(“Prodotti-Archivist|Archivist.html|ArchiBOX.html|Conservazione-Sost.html|Digitalizzazione-C-Terzi.html|Stoccaggio.html”, $_SERVER[“REQUEST_URI”]))
$ja_headerimg=”sh04.jpg”;
?>and then write
<div id=”ja-sh” class=”clearfix”….”>
[/PHP]September 11, 2007 at 10:27 am #229250Thanks for the support, joomlart_pianeta.
I tried different setting and at last I ended to figure it out; I first tried as you said, but it won’t work, next I created a var and put the address inside, echoeing it on screen. After that I was able to figure the differences between the Urls.
Thank You very much, you helped me to solve one of the biggest headache problems.For who’s interested here’s the solution:
<?php
$indirizzo = $_SERVER['REQUEST_URI'];
echo $indirizzo; //used for debug purposes
if (eregi("id=23|id=31|id=24|id=28|id=32", $indirizzo))
$ja_headerimg="sh02.jpg";
?>
-
AuthorPosts
This topic contains 7 replies, has 2 voices, and was last updated by archivistsrl 17 years, 2 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum