Different image for each category?

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Anti-Spam Guide
Locked
satandream
Registered User
Posts: 383
Joined: Thu Mar 06, 2008 12:47 pm

Different image for each category?

Post by satandream » Fri Jul 22, 2011 6:16 pm

I know where to put a image so it shows under the categories, but i want to have different image for each.
Is it possible to do so? And i do not think in APC :D

User avatar
Sniper_E
Registered User
Posts: 790
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey
Contact:

Re: Different image for each category?

Post by Sniper_E » Wed Jul 27, 2011 1:30 am

Under the categories? Do you mean where the forums are listed?
You do know that you can add different images to each forum name in the ACP.

If you just want a different image in each category section you could edit the template.

Open prosilver/template/forumlist_body.html
FIND

Code: Select all

	<!-- IF forumrow.S_IS_CAT or forumrow.S_FIRST_ROW  or forumrow.S_NO_CAT  -->
		<div class="forabg">
			<div class="inner"><span class="corners-top"><span></span></span>
			<ul class="topiclist">
				<li class="header">
					<dl class="icon">
						<dt><!-- IF forumrow.S_IS_CAT --><a href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><!-- ELSE -->{L_FORUM}<!-- ENDIF --></dt>
On the line above:

Code: Select all

						<dt><!-- IF forumrow.S_IS_CAT --><a href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><!-- ELSE -->{L_FORUM}<!-- ENDIF --></dt>
You can add your image in like this:

Code: Select all

						<dt><!-- IF forumrow.S_IS_CAT --><a href="{forumrow.U_VIEWFORUM}"><img src="./images/cat/{forumrow.FORUM_ID}.gif" alt="" /> {forumrow.FORUM_NAME}</a><!-- ELSE -->{L_FORUM}<!-- ENDIF --></dt>
Then in your ./images/ directory create a directory named ./images/cat/
Place all of your category images in that directory and name them 1.gif, 7.gif, 12.gif, etc...
The #.gif image name will correspond to the FORUM_ID # that each category has.

Is this what you're wanting?
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
:!: Sniper_E Styles | phpbbmodders :!:

satandream
Registered User
Posts: 383
Joined: Thu Mar 06, 2008 12:47 pm

Re: Different image for each category?

Post by satandream » Wed Jul 27, 2011 7:57 am

Yes it is as i was wondering to include the category ID :D

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: Different image for each category?

Post by 4_seven » Wed Jul 27, 2011 6:12 pm

imagine you cat have forum id 16

Code: Select all

<!-- IF forumrow.S_FORUM_ID == 16 -->
cat is just a forum id, a little different, but in the first degree a forum id ;)
Current Mods | Mod Base | php(BB) programming | No help via PM

Contour
Registered User
Posts: 47
Joined: Sun Nov 25, 2007 1:17 pm

Re: Different image for each category?

Post by Contour » Sun Oct 16, 2011 1:19 pm

Sniper_E wrote:Under the categories? Do you mean where the forums are listed?
You do know that you can add different images to each forum name in the ACP.

If you just want a different image in each category section you could edit the template.

Open prosilver/template/forumlist_body.html
FIND

Code: Select all

	<!-- IF forumrow.S_IS_CAT or forumrow.S_FIRST_ROW  or forumrow.S_NO_CAT  -->
		<div class="forabg">
			<div class="inner"><span class="corners-top"><span></span></span>
			<ul class="topiclist">
				<li class="header">
					<dl class="icon">
						<dt><!-- IF forumrow.S_IS_CAT --><a href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><!-- ELSE -->{L_FORUM}<!-- ENDIF --></dt>
On the line above:

Code: Select all

						<dt><!-- IF forumrow.S_IS_CAT --><a href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><!-- ELSE -->{L_FORUM}<!-- ENDIF --></dt>
You can add your image in like this:

Code: Select all

						<dt><!-- IF forumrow.S_IS_CAT --><a href="{forumrow.U_VIEWFORUM}"><img src="./images/cat/{forumrow.FORUM_ID}.gif" alt="" /> {forumrow.FORUM_NAME}</a><!-- ELSE -->{L_FORUM}<!-- ENDIF --></dt>
Then in your ./images/ directory create a directory named ./images/cat/
Place all of your category images in that directory and name them 1.gif, 7.gif, 12.gif, etc...
The #.gif image name will correspond to the FORUM_ID # that each category has.

Is this what you're wanting?
Thanks, just what I needed.

Contour
Registered User
Posts: 47
Joined: Sun Nov 25, 2007 1:17 pm

Re: Different image for each category?

Post by Contour » Sun Oct 16, 2011 9:31 pm

Someone knows how can I do the same in category view? I don't know how to retrieve the category image there, with "<img src="./images/cat/{forumrow.FORUM_ID}.gif" alt="" />" it doesn't find the image.

Regards.

User avatar
Sniper_E
Registered User
Posts: 790
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey
Contact:

Re: Different image for each category?

Post by Sniper_E » Mon Oct 17, 2011 1:44 am

The images added above were in the forumlist_body.html
If you want to see those in the view category page,
you need to edit the viewforum_body.html
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
:!: Sniper_E Styles | phpbbmodders :!:

satandream
Registered User
Posts: 383
Joined: Thu Mar 06, 2008 12:47 pm

Re: Different image for each category?

Post by satandream » Tue Nov 01, 2011 9:04 am

Can somebody explain me with some codes to show how to do this with categories?
I cant mange to get it work so to change only category ID and image i can manage ;)

User avatar
Sniper_E
Registered User
Posts: 790
Joined: Wed May 09, 2007 12:18 am
Location: Shreveport, Louisiana
Name: Ed Humphrey
Contact:

Re: Different image for each category?

Post by Sniper_E » Wed Nov 02, 2011 5:20 am

Try this in your viewforum_body.html template...

Code: Select all

					<dt><img src="./images/cat/{topicrow.FORUM_ID}.gif" alt="" /> <!-- IF S_DISPLAY_ACTIVE -->{L_ACTIVE_TOPICS}<!-- ELSEIF topicrow.S_TOPIC_TYPE_SWITCH and (topicrow.S_POST_ANNOUNCE or topicrow.S_POST_GLOBAL) -->{L_ANNOUNCEMENTS}<!-- ELSE -->{L_TOPICS}<!-- ENDIF --></dt>
Image
No is NEVER an Option and NEVER is the only Option when it comes to Giving Up!
:!: Sniper_E Styles | phpbbmodders :!:

User avatar
kiwipearls
Registered User
Posts: 30
Joined: Thu Sep 16, 2010 7:18 am
Location: Auckland, New Zealand
Contact:

Re: Different image for each category?

Post by kiwipearls » Thu Feb 02, 2012 11:27 pm

Just use this code to display the image for the catergory.

Code: Select all

<dt><!-- IF forumrow.S_IS_CAT --><span class="forum-image">{forumrow.FORUM_IMAGE}</span><a href="{forumrow.U_VIEWFORUM}">{forumrow.FORUM_NAME}</a><!-- ELSE -->{L_FORUM}<!-- ENDIF --></dt>
						
Just upload a image for a category forum the same as you upload for a Forum.


Much much easier and no messing about with forum ids.
"In the real world as in dreams, nothing is quite what it seems" - The Book of Counted Sorrows

User avatar
4_seven
I've Been Banned!
Posts: 5155
Joined: Wed Apr 30, 2008 1:41 am

Re: Different image for each category?

Post by 4_seven » Thu Feb 02, 2012 11:46 pm

Contour wrote:Someone knows how can I do the same in category view? I don't know how to retrieve the category image there, with "<img src="./images/cat/{forumrow.FORUM_ID}.gif" alt="" />" it doesn't find the image.
may look in corresponding php, that FORUM_ID is set for cat, where you want to use it.

edit: nevermind, it was solved before
Sniper_E wrote:

Code: Select all

{topicrow.FORUM_ID}
Current Mods | Mod Base | php(BB) programming | No help via PM

Contour
Registered User
Posts: 47
Joined: Sun Nov 25, 2007 1:17 pm

Re: Different image for each category?

Post by Contour » Fri Feb 03, 2012 11:44 am

Thanks! I'll try.

yf_pro
Registered User
Posts: 73
Joined: Sat Feb 16, 2013 4:59 am

Re: Different image for each category?

Post by yf_pro » Mon Mar 18, 2013 7:53 pm

This is really close to what I need. But instead of category, I wanna display a banner next to each forum.
like this. Any solution?
Image

Locked

Return to “[3.0.x] MOD Requests”