Itemlinks customization in floatrix theme

kdji123

Joined: 2009-05-05
Posts: 24
Posted: Sun, 2011-07-31 09:12

Hello friends,

In theme.inc for floatrix theme following function is defined:-

Quote:
/**
* Split item links into user and admin actions
*/
function _splitItemLinks(&$template) {
$theme =& $template->getVariableByReference('theme');
$userViews = array(
'slideshow.Slideshow' => true,
'slideshowapplet.SlideshowApplet' => true,
'comment.AddComment' => true,
'comment.ShowAllComments' => true,
'ecard.SendEcard' => true,
'rss.SimpleRender' => true,
);
$theme['userLinks'] = array();
foreach ($theme['itemLinks'] as $i => $link) {
if (isset($link['params']['view']) && isset($userViews[$link['params']['view']])) {
$theme['userLinks'][] = $link;
unset($theme['itemLinks'][$i]);
}
}
}

and the code which calls this function in photo.tpl is:-

Quote:
{if !empty($theme.userLinks)}
{g->block type="core.ItemLinks" useDropdown=false
links=$theme.userLinks class="floatrix-userLinks"}
{/if}

I want this same functionality in classic theme and pasted the above codes in respective files but the links did`nt show up, will some body help me to figure out what is wrong!

regards,

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2011-07-31 13:28

the templates do not call the function, they place the variables.
the functions that call _splitItemLinks are in theme.inc - function showPhotoPage, function showAlbumPage - which in turn add the variables to the template.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
kdji123

Joined: 2009-05-05
Posts: 24
Posted: Sun, 2011-07-31 15:17

my apologies for wrong choice of terms,actually the above code works in floatrix theme than why not in classic,

check this thread also http://gallery.menalto.com/node/95068, please tell me how I can find the solution.thanks

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2011-07-31 20:15

examine floatrix theme.inc
in function showPhotoPage and function showAlbumPage there are calls to function _splitItemLinks which are required to load the proper variables into the associated templates.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
kdji123

Joined: 2009-05-05
Posts: 24
Posted: Fri, 2011-09-02 12:43

I have minor problem,

$theme['userLinks'] = array();
foreach ($theme['itemLinks'] as $i => $link) {
if (isset($link['params']['view']) && isset($userViews[$link['params']['view']])) {
$theme['userLinks'][] = $link;
unset($theme['itemLinks'][$i]);
}

the favourite module uses the parameter 'controller' in stead of 'view',so it does not get split.however the below code only splits favourite module and leaves others intact

$theme['userLinks'] = array();
foreach ($theme['itemLinks'] as $i => $link) {
if (isset($link['params']['controller']) && isset($userViews[$link['params']['controller']])) {
$theme['userLinks'][] = $link;
unset($theme['itemLinks'][$i]);
}

I want that I may be able to do both.