Recent Topics

1 Apr 08, 2016 06:03    

I'm working on a custom skin, and I'm trying to find where the folder display code is. What I want to do is attach multiple folders, but in a way that allows me to put a title between each one. Even if all it does is put the name of the folder itself, that's fine. I don't know if that's possible just through the template files or it would require a plugin. Any suggestions would be helpful!

2 Apr 08, 2016 08:39

Hi @dubird ,
The code where you should put into is the parameter params['gallery_table_start'] of each skin template page in which you eager to show the gallery pictures (index or item_content page). But it seems not easy to get the folder name directly. However, if you just want to show the folder name in every collection and every showing page, then it is much easier and simple. The way as follows:

  1. Please check the file inc\files\model\_file.class.php, seach the code $r .= $params['gallery_table_start'];, at the line about 1238.
  2. Add the code

    $params['gallery_table_start'] .= "<div style='padding:10px 0 5px 0;clear:both'>".$this->get_name()."</div>";

    before

    $r .= $params['gallery_table_start'];

That's all.

3 Apr 11, 2016 21:22

That does work, thanks!

What I would like to do is to make it only apply to a specific theme, if possible. What I'm working on is based off the bootstrap theme, that part is not in the index.php template file. In the _item_content.inc file, there is a before images paramater:

'before_gallery'  => '<div class="bGallery">',

So, would I set it there in that particular theme folder, as in

'before_gallery'  => '<div style='padding:10px 0 5px 0;clear:both'>".$this->get_name()."</div><div class="bGallery">',

If it's not possible, it's not a big deal, just something I may want to not have in the future, so having it only apply to a specific theme would be useful.

Or (this just occured to me) is it possible to grab the long title from the meta data and display that?

4 Apr 14, 2016 02:55

@dubird
I am sorry for replaying in this later time, because these days I am so busy. I have tested that it could be used in a specific theme by transmiting a param, later time I will show the way.(now I use the phone, it's not convenient)

And what's the meaning of long title from the meta data , would you like to show me an example?

5 Apr 14, 2016 18:26

@dubird

The way of using gallery name in a specific theme:

  1. Please check the file inc\files\model\_file.class.php, seach the code $r .= $params['gallery_table_start'];, at the line about 1238. (of course, the tag 'before_gallery' is also ok)
  2. Add the code

    if(isset($params['show_gallery_name']) && $params['show_gallery_name']) { // if parameter 'show_gallery_name' is set and is true, then show the gallery name
            $params['gallery_table_start'] .= "<div class='gallery_name'>".$this->get_name()."</div>";
    }

    before

    $r .= $params['gallery_table_start'];
  3. In the file _item_content.inc(or other pages which you would like to show the gallery pictures), search the words : $Item->images( array(, you add a paramater into it('show_gallery_name' => true,) , so it's like:

    $Item->images( array(
            'show_gallery_name'             => true, 

    The meaning of it is telling the get imagelist function showing the gallery name in this skin.

That's all.

6 Apr 17, 2016 11:04

@haharen that's a pretty neat solution, considering that it's currently impossible to do something like this without a core hack.

However, taking your suggestion as base, I'm sending a feature proposal to include a new event that will let skins & plugins developers to manage how the galleries are displayed. The main idea is to provide enough flexibility to be able to override the default galleries presentation according to the developer's needs.

Please see: https://github.com/mgsolipa/b2evolution/commit/14200dd76426165d602b92dce81c0b43b65e1f51, for the new event is implemented.

And: https://github.com/mgsolipa/b2evolution/commit/1c115b2fa6d32d8b4bf5739a10e4f9e5a3baa849, where the event is used from a plugin & skin.

Note: I'm linking a forked repository, so this is not an official feature. If it makes its way to the standard release, we will let you know.

Thank you.

7 Apr 17, 2016 11:10

@dubird if you want to use the "Long title" to set a "prettier" name to your galleries (the folder name has some restrictions), please replace point 2 suggested by @haharen with the following code:

$this->load_meta();
if(isset($params['show_gallery_name']) && $params['show_gallery_name']) { // if parameter 'show_gallery_name' is set and is true, then show the gallery name
	$params['gallery_table_start'] .= "<div class='gallery_name'>".$this->title."</div>";
}

In addition to that, please remember that all this is a core hack, which is not a good practice. Mainly because you will loose this feature when update to a higher version. As I mentioned in my previous comment, we will let you know if there is a standard method to implement the feature.

Regards!

8 Apr 18, 2016 01:46

@mgsolipa
Ok, thank you, some code is still in understanding.

I am sorry for having not researched the importing regional code, the time really a bit of tight for I am taking part in a training, will still last for several days. I'll take out time in some way, please understand.

9 Apr 18, 2016 06:54

You're welcome @haharen .

BTW, there is nothing to be sorry about. We appreciate all the help you provide here in the forums.

Regarding that regional info plugin, I'll also try to allocate some time to work on it.

Thank you!

10 May 02, 2016 20:13

Ok, haven't been able to work on this lately due to class, but wanted to comment that I tried the first suggestion, gave it a unique class name, and on skins I don't want it showing up, I can set it to hidden. That's working for now, and when I have spare time again (probably when semester is over!) I will try the second method and let you know how that worked. Thanks to both of you!

11 May 16, 2016 04:17

@dubird please post a final screenshot or a mockup of what you want so we can integrate this as an option into a future version of the core without requiring a hack.


Form is loading...