Recent Topics

1 Mar 07, 2007 13:43    

My b2evolution Version: Not Entered

i have a blog with several categories and subcategories. when i post something in caegory A, i always insert the same image in the post, so it would be useful for me to have the blog engine doing this itself. something like "each time i select categoy A, the image Z must be inserted in the post".

is it possible??

thank you!!

2 Mar 08, 2007 11:21

Simplest solution :-

<div class="bPost inCat<?php echo $Item->main_cat_ID; ?>" lang="<?php $Item->lang() ?>">
		<?php
			$Item->anchor(); // Anchor for permalinks to refer to
		?>
		<div class="bText">
		<div class="imgPad">&nbsp;</div>
			<?php $Item->content(); ?>


/* change the category numbers to match your own */
.imgPad{
display:none;
width:100px; /* change to your image width */
height:100px; /* change to your image height */
float:left;
background:center center no-repeat;
}

.inCat1 .imgPad{
display:block;
background-image:url( img/picture.jpg);
}


.inCat2 .imgPad{
display:block;
background-image:url( img/picture2.jpg);
}

¥

3 Mar 19, 2007 00:52

hmmm i just tried this out but it didn't work somehow :/
what does this part

<div class="bPost inCat'.$Item->main_cat_ID.'"" lang="<?php $Item->lang() ?>"> 


do? thanks so far :)

4 Mar 19, 2007 09:12

Herm wrote:

hmmm i just tried this out but it didn't work somehow :/
what does this part

<div class="bPost inCat'.$Item->main_cat_ID.'"" lang="<?php $Item->lang() ?>"> 


do? thanks so far :)

yeh i also tried it and the more i get is the text area width reduced to leave a blank space for the supposed image, though the image does not load.

this part is meant to "write" the following html code in the final post view

<div class="bPost inCat42" lang="en-UK"> 

where 42 is the number of the category to which you want to set a default image.

i do not know much about PHP code, but the solution seems to be good though there's some problem in the code. if it could be checked it would be great.

5 Mar 19, 2007 10:16

If your category ID == 42 then you need to be defining the following class in your css, you'd obviously need to change the image path/filename to suit.

.inCat42 .imgPad{
display:block;
background-image:url( img/picture.jpg);
}

If you still can't get the images to load then just leave a link to your blog so I can see what's going wrong

¥

6 Mar 19, 2007 12:19

i changed the first line into:

<div class="bPost inCat<?php echo "$Item->main_cat_ID" ?>"> 

and now everything works fine :)

7 Mar 19, 2007 12:31

Lol, ooops, in my _main.php I'm echoing the whole of that line :p

I've corrected my original post :P

¥

8 Mar 19, 2007 14:58

yeeeeh!! that's it!! thanks a lot folks!! ;)


Form is loading...