SimplePortal

Customization => Custom Coding => Topic started by: mez on January 15, 2011, 08:19:42 PM

Title: "Where it Shows" drop-down in Blocks List
Post by: mez on January 15, 2011, 08:19:42 PM
Quote
SMF 2.0 RC4
SP 2.3.3
psylergic.net

I'd like to add a column into my Admin Block List to show which pages I have each block displayed on. Perhaps I am searching the wrong keywords, but I imagine someone has already thought of it and created a simple solution for it? Otherwise, I'm fairly confident with PHP once I know where to look.

Thank you in advance :)
Title: Re: Additional column in Admin Block List
Post by: AngelinaBelle on January 17, 2011, 11:59:26 AM
That is a really good feature request, and I think the devs are also interested in this one. As far as I know, this has not been done here yet.
Title: Re: Additional column in Admin Block List
Post by: mez on January 18, 2011, 05:21:52 AM
Maybe a dropdown select list in that column to show where more than one page contains the block? Anyone wanna start me on this? I'm confident with PHP... ish :P

Never made a mod before :o
Title: Re: Additional column in Admin Block List
Post by: AngelinaBelle on January 18, 2011, 09:11:44 AM
PortalAdminBlocks.template.php is a place to see the blocks list template.
After that, you'll want to know how $context['blocks'], $context['sides'], etc. gets filled in.
 
If you are good with php, you are probably good with tools you can use to search all your files for a string like 'sides', 'blocks', etc.
 
To achieve this, you are going to want, for each $context['blocks'][$side['name']][$block_id] , to fill in the list of places it appears. You can figure this out by retrieving all the display information from the blocks table.
 
Finally, you can figure out how to display that list of places in the blocks list template.
 
 
Title: Re: Additional column in Admin Block List
Post by: mez on January 18, 2011, 09:51:24 AM
Nice! That's just what the doctor ordered! Thanks! See the attachment for what I have working so far.

The only issue I'm having is the $pages array doesn't become available until a page action occurs, so the selects are not exactly listing the page name as yet.

Any idea's on this? Or should I resort to good-old $smcFunc and make a new query?
Title: Re: Additional column in Admin Block List
Post by: AngelinaBelle on January 18, 2011, 11:00:50 AM
Any ideas on this? Or should I resort to good-old $smcFunc and make a new query?

I'm a support specialist, not a customizer, so I haven't worked through that code. At this moment, you know as much as I do, or more. So have fun with it!
Title: Re: Additional column in Admin Block List
Post by: mez on January 19, 2011, 07:41:56 AM
Ok it's done. If anyone wants to turn it into a mod, msg me :)
SimplePortal 2.3.8 © 2008-2024, SimplePortal