I have a content div (green box) that contains the [*#content*] and another div called adsense. I want the ad to be placed 2 inches down on the page, AND have all the text to wrap around it. Is this possible to do with css (see pic)? I want the text to wrap around the top, right, and bottom of the ad. I set a top margin to lower the image 2 inches. Then I set it to float left, but this doesn’t allow the text to flow on the top of the image. Only the right and bottom.
I could accomplish this by inserting and {{AdSense}} chunk into each [*#content*], but that defeats the purpose of keeping everything separate. I want to accomplish this at the template level.
#content {width: 500px;border-style: solid;}
#adsense {float: left; width: 60; height: 50px; padding: 10px; margin: 100px 15px 0 0; border: solid thin;}
-Dorian
Talltree, nice! Could this be modified to only insert the first paragraph of the main text of an article?
I’m using Ditto to make a blog page, but introtext can have no pictures (drab blog page) so I’m looking for a way to also include the first <p>.
-
☆ A M B ☆
- 24,524 Posts
<?php
$content = $modx->documentObject['content'];
$content = explode('</p>', $content);
echo $content[0]; // insert the first paragraph
echo $modx->getChunk('adsense1'); //insert your chunk here
?>
Very slick, Susan. But won’t the first paragraph show twice unless the [*#content*] tag is left out of the template (and then you’d lose the rest of the paragraphs)?
Bob
-
☆ A M B ☆
- 24,524 Posts
Use this snippet in place of [*conent*] and your chunk will show up after the paragraph you specify in $where.
Talltree, nice! Could this be modified to only insert the first paragraph of the main text of an article?
Quote from: sottwell at Feb 14, 2008, 12:13 AM
Use this snippet in place of [*conent*] and your chunk will show up after the paragraph you specify in $where.
Talltree, nice! Could this be modified to only insert the first paragraph of the main text of an article?
Argggg. . . I’m about 0 for 6 today.
I should have taken the day off.
Bob
-
☆ A M B ☆
- 24,524 Posts
I frequently have days like that. Fortunately for me I’m in a position where I can either just go back to bed or go for a long walk in the desert. I’m trying to cut down on the going out to get chocolate, though.
OK, so I could use the part above the getChunk to extract the first paragraph, and include the output after the Ditto call somehow?