/    Sign up×
Community /Pin to ProfileBookmark

Pad out HTML using PHP

Hello,

I am currently extracting my XHTML from a couple of fields in a database to make up the main content of the pages.

However when I echo it out all the <div>’s get bunched up together in the source code, and I’m sure this is why it gives me layout errors in Safari, and nothing else.

Is there any way to ‘pad out’ the spacing between parts of the HTML.

I’d tried using the ‘nn’ and it worked on something else, but not this one sadly.

[code=php]
echo ‘<div class=”centrewide”>’;
echo ‘<img src=”‘ . $main_image . ‘” alt=”‘ . $title . ‘” />’;

echo ‘<div class=”left_content2″>’;
echo $left_content;
echo ‘</div>’;
echo ‘<font color=”#fff”>’;
echo ‘nn’;
echo ‘</font>’;

echo ‘<div class=”centre_content2″>’;
echo $centre_content;
echo ‘</div>’;
echo ‘<font color=”#fff”>’;
echo ‘nn’;
echo ‘</font>’;

echo ‘<div class=”right_content2″><img src=”../img/answers_questions.jpg” width=”154″ height=”741″ /></div>’;
[/code]

The variables like $centre_content are XHTML taken from the SQL database.

I’m sure I’ve seen an easy way to ‘pad’ out the coding, but just can’t seem to do it.

Any solutions would be most helpful.

Thank you!

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@invisionauthorOct 30.2007 — I'm not even too sure if that's the problem.

I've XHTML/CSS-validated it, but nothing major has turned up. Just Safari I guess.
Copy linkTweet thisAlerts:
@callumdOct 30.2007 — You need double quotes around your "[b]nn[/b]".

Using single quotes will echo precisely what you type (in this case, literally putting [b]nn[/b] in to your HTML source code). Using double quotes will [i]interpret[/i] the special characters (turning [b]nn[/b] in to new lines, for example).
Copy linkTweet thisAlerts:
@invisionauthorOct 30.2007 — aaaah. Thanks, of course. Will try that.


Thanks.
Copy linkTweet thisAlerts:
@invisionauthorOct 30.2007 — Hmm, I seem to have resolved it, slightly.

Problem seems to be the picture stored in the .centrewide class.
Copy linkTweet thisAlerts:
@invisionauthorOct 30.2007 — Yup, it was that.

Just added a div to clear both and it was sorted ?

Thanks for the help and apologies for the slightly meaningless posts above.
Copy linkTweet thisAlerts:
@callumdOct 30.2007 — No worries. Glad you got it fixed.
×

Success!

Help @invision spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...