Insert Album Into Page Jaws 1.1.1 - ActionImport

Cool tips and tricks about Jaws

Insert Album Into Page Jaws 1.1.1 - ActionImport

Postby hayden » Mon Nov 24, 2014 11:01 am

So its fairly simple to enable support for this, a lot simpler than it used to be,

Firstly you must install ActionImport plugin, in the Control Panel->Components Plugins section.

just edit /gadgets/Phoo/Actions/Photos.php

change

Code: Select all
    function ViewAlbumPage()
    {
        $tpl = $this->gadget->template->load('ViewAlbumPage.html');
        $tpl->SetBlock('ViewAlbumPage');


        $get = jaws()->request->fetch(array('id', 'page'), 'get');
        $id  = !empty($get['id'])? $get['id'] : '0';
        $page = !empty($get['page'])? (int) $get['page'] : 1;
 


to

Code: Select all
    function ViewAlbumPage($id = 0)
    {
        $tpl = $this->gadget->template->load('ViewAlbumPage.html');
        $tpl->SetBlock('ViewAlbumPage');

        if (empty($id)) {
            $get = jaws()->request->fetch(array('id', 'page'), 'get');
            $id  = !empty($get['id'])? $get['id'] : '0';
            $page = !empty($get['page'])? (int) $get['page'] : 1;
         }   
     


then down a few lines you might want this to stop it naming your page's title after your imported album:
change:
Code: Select all
         
            // display album info
            if ($id == '0') {
                $tpl->SetVariable('title', _t('PHOO_UNKNOW_ALBUM'));
                $this->SetTitle(_t('PHOO_UNKNOW_ALBUM'));
                $tpl->SetVariable('description', '');
            } else {
                $tpl->SetVariable('title', $album['name']);
                $this->SetTitle($album['name']);
                $tpl->SetVariable('description', $this->gadget->ParseText($album['description']));
            }

to
Code: Select all
if (empty($id)) {
            // display album info
            if ($id == '0') {
                $tpl->SetVariable('title', _t('PHOO_UNKNOW_ALBUM'));
                $this->SetTitle(_t('PHOO_UNKNOW_ALBUM'));
                $tpl->SetVariable('description', '');
            } else {
                $tpl->SetVariable('title', $album['name']);
                $this->SetTitle($album['name']);
                $tpl->SetVariable('description', $this->gadget->ParseText($album['description']));
            }
}


then just add this to load a album:
Code: Select all
[import gadget="Phoo" action="ViewAlbumPage" params="1"]


then create some css style rules to your need
hayden
 
Posts: 96
Joined: Wed Oct 22, 2008 12:17 pm
Location: Sydney, Australia

Return to Tips and Tricks

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron