Well I have been trying to find a way to modify the page.tpl.php code that uses the style.css file from the 007 nigraphic theme, in order to make the random images contain a link to the appropriate site in which the image refers. I believe it is this line in the page.tpl.php file that needs to have some additional logic conditions? I just don't know how to go about doing it.
.<div id="maincolHead" class="banner<?php print rand(1,4); // set number of random banners ?>">
</div>Possibly a better way if possible would be to have the css file where the page.tpl.php file is already pointing to the image, already contain the link code. I have not been able to find a solution to do this using the existing code with modifications.
I am not very experienced with css but I have learned some useful things along the way. This would be a good feature to have for most sites. On my site the Bands will get to have their banners put into this spot on the site and I would like to have it link to their site from this banner.
If anyone knows of how to do this please help, or a link to some info showing or discussing this would be great too.
Eric
Comments
No Help Yet
Well I guess, I need to learn how to program PHP to figure this one out. Normally I would just use perl and CSS to position links and images anywhere I please, but I don't program with PHP so I am lost. I would think that if CSS has the code for url that it must be able to anchor that too with a link. I will continue to pursue this one and possibly contact the developer of the theme for some help on this. Also since it is using the random PHP code it would already have selected the image to use and would make more since for the CSS to anchor that image as opposed to using a few more lines of code in the PHP file. Maybe I am wrong though and this has to be done with PHP only. If anyone can point me into the right direction, CSS do the link or PHP?
Thanks
Eric
PHP, I'm afraid
I don't know a thing about the theme you're using, but you won't be able to add a link with the CSS. There's no way to add new markup (like an <a> tag) in CSS.
Based on what you've said here, it looks to me like the code just sets the div's class to banner1, banner2, banner3, or whatever, and each of these is defined in the CSS as having a different background image.
What you'd need to do is add a bit of PHP to your page.tpl.php that stores the random number, uses that number to determine which URL to point to, embeds the link, and sets the div's class to banner1, banner2, or whatever. To make it even trickier, you may need to add some width and height attributes to the <a> tag, since it won't wrap around the background image.
Good help
Thanks this is good help. Now I can focus on learning the PHP conditional code that I will need. If ran eq 1 do this etc just got to make sure I match them up correctly. I know nothing about PHP so I guess it is time to start learning. I am wondering, if it is close enough to perl If so I could maybe look at some of my old Perl code that allows me to do this sort of thing. I'm getting so tired of doing this update site thing and modify this thing and that thing with my site. It might be time to just save up some money and have someone do it for me so that I can get back into what I am good at with my music creations. I appreciate the help very much. I guess I could use image maps too I suppose, but this is kind of old school right ha ha. Good ole Gimp does a pretty good job with making those little guys.
Thanks
Eric
PHP & PERL
I never knew PERL all that well, but I found the transition to PHP to be pretty easy. And what you need to do here wouldn't be that complicated, I think&mdasah;probably just a
switchstatement on a variable that's been set to a random number.You might also try posing your question as a support request for the specific theme you're working with. (Go to the theme's page and start a new issue.)
Feature request
Ok, I will go to the themes issues area and post a request for this feature. I think most people will use something like this for advertising or in my case Banner ads for musicians and some adverts, and I think most of these type of banners would need to link to their sites. They could probably fix this before I could learn PHP, considering my busy schedule that is. Thanks for the advice.
Eric