[3.0.x] Custom background image for each topic!

For support and discussion related to templates, themes, and imagesets in phpBB 3.0.
Ideas Centre
Locked
adma
Registered User
Posts: 4
Joined: Mon Sep 02, 2013 3:48 am

[3.0.x] Custom background image for each topic!

Post by adma » Mon Sep 02, 2013 3:54 am

I've searched with a thousand of keywords but I couldn't found a right thing that I need, I want to change my background image set for spesific topic in the spesific board if it's possible. And I used to use IF function code but it doesn't work and could someone help me with the code? there are a lot of topics with IF function but none of them shows the IF function colaborated topic and forum, thanks in advance!

User avatar
Rahber
Style Customisations
Style Customisations
Posts: 2720
Joined: Tue Feb 12, 2008 3:39 pm
Location: Pakistan
Name: Rahber
Contact:

Re: [3.0.x] Custom background image for each topic!

Post by Rahber » Mon Sep 02, 2013 5:38 pm

hi, Please explain.

Are you trying to have background of every post in single topic in viewtopic.php or you want background of the list of topics on viewforum.php?

What i understand from you post is that on viewtopic.php you want to have specific background for a topic.

So i have this in my viewforum_body.html

Code: Select all

<li class="row<!-- IF topicrow.TOPIC_ID == 30 --> ppk<!-- ENDIF --><!-- IF topicrow.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_POST_GLOBAL --> global-announce<!-- ENDIF --><!-- IF topicrow.S_POST_ANNOUNCE --> announce<!-- ENDIF --><!-- IF topicrow.S_POST_STICKY --> sticky<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->">
you can notice that i have assigned a class ppk when my topic id is 30. and then i can add it to style similarly you can replace the {topicrow.TOPIC_FOLDER_IMG_SRC} with your image placing it in a if clause.

If you were asking something else please explain.

adma
Registered User
Posts: 4
Joined: Mon Sep 02, 2013 3:48 am

Re: [3.0.x] Custom background image for each topic!

Post by adma » Mon Sep 02, 2013 6:42 pm

Thank you for your answer and I really deeply appreciate that. Is it possible if I took the background image with link off-site? because I have topic to be modified with different board. I saw your code the syntax only shows the topic ID without the forum ID, I've seen another forum with different way and when I saw the source code, honestly it was written on javascript. The example code will be displayed below this

Code: Select all

<script language="JavaScript">
var SAMPLE_A_check      = 'FORUM NAME • View topic - SAMPLE A';
var SAMPLE_B_check      = 'FORUM NAME • View topic - SAMPLE B'';

var url_title_check = document.title

if( url_title_check == check  )
{
	document.body.style.backgroundImage='url( http://sample.com/sample.jpg )';
	document.body.style.backgroundColor=' #000000 ';
	document.write('<embed src="http://www.youtube.com/v/sample&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="200"></embed>')
	/*var song_random = Math.floor(Math.random()*2)
	if( !song_random )
	{
		document.write('<embed src="http://www.youtube.com/v/sample&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="200"></embed>')
	}
	else
	{
		document.write('<embed src="http://www.youtube.com/v/sample&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="200"></embed>')
	}*/
}

else if( url_title_check == sample_check  )
{
       document.body.style.backgroundImage='url( http://sample.com/sample.jpg )';
       document.body.style.backgroundColor=' #000000 ';
       document.write('<embed src="http://www.youtube.com/v/sample&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="200"></embed>')
}
</script>
I found these codes from the source code function of Firefox. From that codes the javascript detects each topic with its topic name. I was like confused which code I should write down to my forum both javascript and if function. Once again thanks in advance.

User avatar
Rahber
Style Customisations
Style Customisations
Posts: 2720
Joined: Tue Feb 12, 2008 3:39 pm
Location: Pakistan
Name: Rahber
Contact:

Re: [3.0.x] Custom background image for each topic!

Post by Rahber » Wed Sep 04, 2013 2:42 am

I am still not sure what exactly you want to do.

Peter77sx
Registered User
Posts: 3250
Joined: Wed Nov 09, 2005 2:51 pm

Re: [3.0.x] Custom background image for each topic!

Post by Peter77sx » Wed Sep 04, 2013 3:27 am

Do you mean different background of the forum only while viewing specific topic/s? maybe with simple bbcode.. an example and it's bbcode here:
http://www.phpbb3bbcodes.com/viewtopic. ... p=230#p230

Not sure what style you are using so it may or may not work.

adma
Registered User
Posts: 4
Joined: Mon Sep 02, 2013 3:48 am

Re: [3.0.x] Custom background image for each topic!

Post by adma » Wed Sep 04, 2013 9:44 am

Rahber wrote:I am still not sure what exactly you want to do.
so sorry if it makes you confused, the only one i want to do is change a spesific topic_id background.
Peter77sx wrote:Do you mean different background of the forum only while viewing specific topic/s? maybe with simple bbcode.. an example and it's bbcode here:
http://www.phpbb3bbcodes.com/viewtopic. ... p=230#p230

Not sure what style you are using so it may or may not work.
yep seems like it doesn't work, and i'm using 0mega style

Locked

Return to “[3.0.x] Styles Support & Discussion”

Who is online

Users browsing this forum: No registered users and 11 guests