Forum

Contextual Block?
 
Notifications
Clear all

Contextual Block?

kali
 kali
(@kali)
Reputable Member

I'm trying to figure out if this is even possible.

Basically, what we want to do certain blocks only on stories, depending on either the category or the rating. Would it be possible to code a block that would check for that/those?

Skins made by Kali are no longer supported!

Quote
Topic starter Posted : 10/01/2014 1:42 am
SJP
 SJP
(@sjp)
Trusted Member

Do you mean you basically want a block that would randomly put up stories that have specific categories or ratings? That is possible. You can modify the files for the recent block to create blocks for whichever category/rating you want. Just go through the files and change the wording (ex. $blocks['recent'], _STORYQUERY." ORDER BY stories.updated DESC LIMIT $numupdated") in the init.php and recent.php files. You can do this for as many files or categories as you want. Let me know if you need more specifics or if this isn't what you meant.

ReplyQuote
Posted : 10/01/2014 4:44 pm
kali
 kali
(@kali)
Reputable Member

Sorry for not being clear.

We want a certain blocks to appear ONLY on certain stories. Such as an ad block that doesn't appear on a mature rated story or a block with information that only appears on stories in a certain category.

Skins made by Kali are no longer supported!

ReplyQuote
Topic starter Posted : 18/01/2014 1:45 am
Lyndsie
(@lyndsie)
Member Moderator

Interesting idea. (Late to the party.) It sounds doable, but probably complicated. You could try adding an if statement to the main file of the block. For the majority of the blocks, they have a filename in the folder that is the same as the folder, and that's where all the functionality is. (ie blocks/featured/featured.php). That's how I copied a block to make two different featured blocks once; I just changed the name it was giving it in that file. However, this might leave the "shell" of the block HTML/CSS-wise. In that case you might have to modify the page in question (ie viewstory.php) to make it stop. But the characteristics you're talking about (rating etc) are stored in the database and irc are in the main query already, so you should be able to make them part of a conditional statement.

ReplyQuote
Posted : 01/05/2014 8:45 am
kali
 kali
(@kali)
Reputable Member

This is what I did, eventually. Not as elegant, but it worked.
http://efiction.org/forums/index.php?topic=8661.0

Skins made by Kali are no longer supported!

ReplyQuote
Topic starter Posted : 03/05/2014 3:26 am
Grimmbart
(@grimmbart)
Active Member

Hello,

a block that shows random storys with equal characters, pairings or classes to the story im reading a.t.m. would be great.

Greetings,

Grimmbart

ReplyQuote
Posted : 09/06/2014 12:14 am
Share: