Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-08-28 11:07:01

hamba
Member
Registered: 2006-08-04
Posts: 22

img tag within a p tag

Hi

I hope some one can help me here
I have a problem with images within the article body

What happens is that when I type some text and insert an image on the next line it gets wraped in the <code><p></code>
when I have an empty line between the text and the image it does not get wrap and so the image shows up in the wrong place

here is the html that gets produced maybe that makes more sense :)
<code><p>more tests<br />
<img src=“someurl/images/38.jpg” width=“500” height=“375” alt=”“ /></p></code>

and
<code><p>some text</p>
<img src=“someurl/images/37t.jpg” alt=“web” /></code>

in my css I have
<code>#content p {
padding: 0 20px;
}</code>

<code>#content img {
padding: 5px 0;
}</code>

Thanks
hamba

Offline

#2 2006-08-28 11:29:24

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: img tag within a p tag

Sorry, I’m not sure I understand what you want. Can you tell me what is the html you want to get?

Offline

#3 2006-08-28 12:05:00

hamba
Member
Registered: 2006-08-04
Posts: 22

Re: img tag within a p tag

lol

What I want is either to get all the img tags wraped in a p tag even if I only include a single image into the body with no text or all the img tags not wraped

so the html code will be
<code><p><img src=“someurl/images/38.jpg” width=“500” height=“375” alt=”“ /></p>

<p>some text<br />
<br />
<img src=“someurl/images/38.jpg” width=“500” height=“375” alt=”“ /></p>

<p>some text<br />
<img src=“someurl/images/38.jpg” width=“500” height=“375” alt=”“ /></p></code>
or
<code><p>some text</p>
<p><img src=“someurl/images/38.jpg” width=“500” height=“375” alt=”“ /></p></code>
This will work with my current css

or the other alternative is
<code><img src=“someurl/images/38.jpg” width=“500” height=“375” alt=”“ />

<p>some text<br /></p>
<img src=“someurl/images/38.jpg” width=“500” height=“375” alt=”“ />

<p>some text</p>
<img src=“someurl/images/38.jpg” width=“500” height=“375” alt=”“ /></code>
here I will have to make some changes to my css

I hope this is a bit more clearer for you
:)

Last edited by hamba (2006-08-28 12:08:16)

Offline

#4 2006-08-28 13:34:07

Skubidu
Archived Plugin Author
Registered: 2004-10-23
Posts: 611
Website

Re: img tag within a p tag

If you want to achive this:

<p>some text</p>
<p><img src="someurl/images/38.jpg" width="500" height="375" alt="" /></p>

You can try this (asuming you are using Textile):

some text
(empty line)
p. !someurl/images/38.jpg!

Offline

#5 2006-08-28 14:06:39

hamba
Member
Registered: 2006-08-04
Posts: 22

Re: img tag within a p tag

When I use Textile I don’t need to add the p. to the image path
it adds it allready.

the problem comes in when you use code like
<code><txp:thumbnail id=“37” /></code>
that I get from using bas_img_selector

one way around this is to use
<code><p><txp:thumbnail id=“37” /></p></code>

this is not that good when the users don’t know html

Last edited by hamba (2006-08-28 14:10:48)

Offline

#6 2006-08-28 20:10:20

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: img tag within a p tag

hamba wrote:

this is not that good when the users don’t know html

I’ve seen this happen before. Apparently if a txp or html tag is used in an article, it isn’t wrapped in <p> tags.
I suppose you can also do this:
<code>p. <txp:thumbnail id=“37” /></code>
But I agree this is not ideal for end-users.

Offline

Board footer

Powered by FluxBB