Can I insert images between categories?

Started by tassie73, April 30, 2012, 12:44:04 AM

Previous topic - Next topic

tassie73

I have had a good read through the topics and even looked into some of the mods that insert ads between categories, but I cannot find a solution to what I want to do.

I simply want to know where in the BoardIndex.template.php that I can insert code to be able to put in an image between the categories to break up the main forum a bit.

If anyone can help me, let me know please.

Cheers

Chris

Matthew K.

Inside the foreach($context['categories'] as $category)

tassie73

Thanks Lab

Do I just add in an image tag in there somewhere?

Sorry, still picking up php on the fly so I ask some seriously simple questions sometimes :-[

Matthew K.

Try something like this...
Code (Find) Select
foreach ($context['categories'] as $category)
{

Code (Add After) Select
echo '<img src="url" alt="" />';
You could add a little bit of code so it wouldn't show after the last category, or something like that. Don't have time to look at the array structure, but it wouldn't be difficult at all.

tassie73

Thanks Lab, will have a looka t this today and let you know how I go. :)

Matthew K.


tassie73

I have managed to get the images into the forum, but can anyone advise how to get them into categories?

I am guessing I need to somehow insert a cat id somewhere but I am just not sure where.

Thanks

Chris

Matthew K.

What do you mean by "in categories"? The code I gave you would work for that, so I'm not sure what you mean.

tassie73

Sorry, I am still getting my head around php. :-[

The code put one image for each category above the first category (see screen shot). I am sure that it is something really simple that I am missing, and looking harder for it is probably not helping either :P

I almost pulled out the little hair I have left trying to find some code in the community board that I think might help me out that was in another post. Should have bookmarked it when I first saw it. :o

Thanks for all the help from a noob :)

Chris



Matthew K.

What you do then is follow the code I gave, and instead of inserting the code right after foreach ($context['categories'] as $category)
{
put it right before the closing }.

tassie73

This is what I have currently.

foreach ($context['categories'] as $category)
   {
   //echo '<img src="http://www.fishingboatingtasmania.com.au/cloud/banner-1.gif" alt="" />';
   if (!empty($modSettings['catsmfstyle_enable'])) {
   if (empty($category['boards']) && !$category['is_collapsed'])
         continue;

      echo '
         <tbody class="header" id="category_', $category['id'], '">
            <tr>
               <td colspan="4"  align="center">
                   
                    ';


The closing } is way down the page after a heap of stuff about collapsed boards and stuff. Should I put it down there?



Matthew K.


tassie73

Let you know in a minute.... had to drop my daughter off at school :o

Matthew K.

Okay, not a problem. If it does, please mark the topic as solved :)

tassie73

Yep, got it!

Thanks mate. Will mark as solved!

Thanks for your patience with a noobie :-[

Chris

Matthew K.

No problem Chris, we're here to help when we can :) Best of luck!

tassie73

Thanks, I am getting the hang of this php now.... I think!

Matthew K.

That's fantastic, it takes time, but it gets easier =)

bellamy2

He wants someone to help me with inserting code?
//echo '<img src="http://www.blitz-srbija.net/22/backdrop.jpg" alt="" />';


bellamy2

My problem is I do not know to do this
{ put it right before the closing }.

Advertisement: