>>
Site Map
>>
Forums
>>
Blocks
Forum module - topics in forum:
Blocks - Having problems with a block? Code doesn't work, get help here.
centering with Nuke7.7
Hey I am having a problem trying to center an image. The content block is formatted differently than I am use to with a HTML in the lower right. Is there anyway I could get rid of this and just have content in a HTML? If not can someone please tell me what the code is for centering. This is the line I am using right now and on my older site it works.
| Code: : |
| <center><img src="images/image/logo.gif" border="0" /><br /> |
any help would be appreciated thx
www.ocrwetpaint.com
2 Problems.... the <center> tag isn't closed it should be
| Code: : |
| <center><img src="images/image/logo.gif" border="0" /></center> |
Also the <center> tag is depricated you should use the <div></div> tag like the following.
| Code: : |
| <div align=\"center\"><img src="images/image/logo.gif" border=\"0\" /></div> |
Notice the \slashes\ they will prevent php from reading the variable within the tags as text.
If you were making a block using this code it might look something like this: | Code: : |
<?php
if (stristr($_SERVER['PHP_SELF'], "block-Sample.php") || stristr($_SERVER['SCRIPT_NAME'], "block-Sample.php")) { Header("Location: ../index.php");
}
$content = "<div align=\"center\"><img src=\"images/image/logo.gif\" border=\"0\" /></div>";
?> |
Well tried this and still nothing. When I use the <div> code it totally gets rid of all the code and I have to start over and when I use the center it automatically erases it from the code when I look at it again. I really appreciate your help though 
How are you making this block?
I'm not making a block I am adding a pic to the front page message but this also happens if I try to add a pic in the downloads section or any where on the site. The content block where I use to put the HTML code is formatted in a differnent style that I am use to where it has the Bold Italic Underline etc......... I am use to the HTML content block but dont know how to change it to that with 7.7 I hope this helps I proabaly should have posted this in a different section SRY and Thx for your help!
What you are calling the HTML Block and a content block is neither, it is a Message Area and is designed really for use with text only (although some html tags are usable). HTML generally tags won't work because for security reasons the slashes are stripped out before the data is placed into the database. Which means </center> would be converted to <center> which would cause you to have 2 opening statments and no closing statement. If you were to remove the ability to remove slashes you are possibly opening your site upto attack.
I have seen where people say it's safe to remove the or alter | Code: : |
| $content = stripslashes(FixQuotes($content)); |
from the admin/modules/admin.php file. But what are you opening your site upto? That remains the unknown question.
The proper way to do this would be to disable the messages and create a block similar to the one SevenofNine showed you how to make. Just for review here it is based on 7.7.0.3.1 coding: | Code: : |
if ( !defined('BLOCK_FILE') ) {
Header("Location: ../index.php");
die();
}
$content = "<div align=\"center\"><img src=\"images/image/logo.gif\" border=\"0\" /></div>";
?> |
What she (SevenofNine) gave you would have worked but this is more secure... Provided you are using 7.7.0.3.1
If you are not using 7.7.0.3.1 then this: | Code: : |
<?php
if (stristr($_SERVER['PHP_SELF'], "block-Sample.php") || stristr($_SERVER['SCRIPT_NAME'], "block-Sample.php")) { Header("Location: ../index.php");
}
$content = "<div align=\"center\"><img src=\"images/image/logo.gif\" border=\"0\" /></div>";
?> |
Should work just fine.
If you follow either of the examples above then you should have no problems getting your image to center in the middle of your site.