>>
Site Map
>>
Forums
>>
Blocks
Forum module - topics in forum:
Blocks - Having problems with a block? Code doesn't work, get help here.
Simple Block
I'm trying to create a simple block that has a picture in it and that picture when clicked on takes you to a website in a new window.
I'm trying and trying, but can't get it to work. I have "0" PHP coding experience, but figured, how hard could it be to modify an existing block.... UGGGH!! LOL
Can someone help me create this? Please.
Thanks, Hell
Here is the code to do exactly what you want.... I will be posting the block it self here on NukeCode later...... I made it a while ago for another site.
| Code: : |
<?php
if (eregi("block-PicturePop.php",$PHP_SELF)) {
Header("Location: index.php");
die();
}
// The name and link of the site you are linking too goes here.
$content = "<div align=\"center\"><a href=\"http://yousite.com\" target=\"_blank\">
// Place the image in your images folder and change the name below
<img src=\"http://yoursite.com/images/yourimage.gif\" width=\"150\" height=\"120\" border=\"0\"></a>";
// the lines below are optional if you don't want to use the textlink you can rem it out or remove it otherwise change the info to be that of the site you are linking too.
$content .= "<br>";
$content .= "<a href=\"http://yoursite.com\" target=\"_blank\">Your Site</a></div>"; |
?>
Just copy and paste the above code into your favorite editor and name it PicturePop.php. Where ever it says yoursite replace it with the appropriate site names. Then upload the PicturePop.php to your blocks folder and the image to your images folder and you are all set.
Happy Nuking
Comment
Hey thanks for the quick response!
I did all that you said and made sure the ending ?> tag was there.
Unfortunately, the line below gets commented out. It start right after the http://All the stuff after this is a comment.
| Code: : |
| <img src=\"http://yoursite.com/images/yourimage.gif\" width=\"150\" height=\"120\" border=\"0\"></a>"; |
Dunno I copied and pasted the code to my editor and tested it on my site works fine.... Anyway here is the code without the comments
| Code: : |
<?php
if (eregi("block-PicturePop.php",$PHP_SELF)) {
Header("Location: index.php");
die();
}
$content = "<div align=\"center\"><a href=\"http://yousite.com\" target=\"_blank\">
// Place the image in your images folder and change the name below
<img src=\"http://yoursite.com/images/yourimage.gif\" width=\"150\" height=\"120\" border=\"0\"></a>";
$content .= "<br>";
$content .= "<a href=\"http://yoursite.com\" target=\"_blank\">Your Site</a></div>";
?> |
See if that helps you
Worked like a champ! Not sure what I did previously! I obviously hosed something up! It's working now, thanks again for taking the time to help me out!
Scott