gallery2 user defined tag not working

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
tim124
New Member
New Member
Posts: 5
Joined: Wed Apr 25, 2007 11:59 am

gallery2 user defined tag not working

Post by tim124 »

im using newest version of cmsms, tried this on the testing server on my laptop and on a live linux server.

ive been trying to integrate the newest gallery2 into my site for a few days. Ive tried G2mod and some other plug-ins but im having the same problem with all of them.

Basically the output from the server haults when it comes across either the module tag or my user defined tag. The html output just stops!

I took some code straight from the gallery2 embed example and made a user defined tag.

The code at the bottom of my post works perfectly in a seperate php file, but when its in a plugin, or user tag cmsms seems to fall over and not give any error

i added some "echo"s to try and work out where it was failing and it appears to fail at:

Code: Select all

$g2moddata = GalleryEmbed::handleRequest();
My php isnt good enough to work out what else is going wrong, but it appears that the modules and tags are all failing at this point

Anybody know whats going on?

Code: Select all

    
require_once('/home/www/markfihh/t/gallery2/embed.php');
    
	$data = array();
	
    // if anonymous user, set g2 activeUser to ''
    $uid = '';
 
    // initiate G2 
    $ret = GalleryEmbed::init(array('g2Uri' => '/gallery/', 
				    'embedUri' => '/main.php',
				    'activeUserId' => $uid));
    if ($ret) {
      $data['bodyHtml'] = $ret->getAsHtml();
      return $data;
    }

    // user interface: you could disable sidebar in G2 and get it as separate HTML to put it into a block
    GalleryCapabilities::set('showSidebarBlocks', false);

    // handle the G2 request
    $g2moddata = GalleryEmbed::handleRequest();
  
    // show error message if isDone is not defined
    if (!isset($g2moddata['isDone'])) {
      $data['bodyHtml'] = 'isDone is not defined, something very bad must have happened.';
      return $data;
    }
    // exit if it was an immediate view / request (G2 already outputted some data)
    if ($g2moddata['isDone']) {
	exit; 
    }
   
    // put the body html from G2 into the xaraya template 
    $data['bodyHtml'] = isset($g2moddata['bodyHtml']) ? $g2moddata['bodyHtml'] : '';

    // get the page title, javascript and css links from the <head> html from G2
    $title = ''; $javascript = array();	$css = array();
 
    if (isset($g2moddata['headHtml'])) {
      list($data['title'], $css, $javascript) = GalleryEmbed::parseHead($g2moddata['headHtml']);
	  $data['headHtml'] = $g2moddata['headHtml'];
    }
    
    
    /* Add G2 javascript  */
    $data['javascript'] = '';
    if (!empty($javascript)) {
      foreach ($javascript as $script) {
	     $data['javascript'] .= "\n".$script;
      }
    }

    /* Add G2 css  */
    $data['css'] = '';
    if (!empty($css)) {
      foreach ($css as $style) {
	     $data['css'] .= "\n".$style;
      }
    }

    // sidebar block
    if (isset($g2moddata['sidebarBlocksHtml']) && !empty($g2moddata['sidebarBlocksHtml'])) {
      $data['sidebarHtml'] = $g2moddata['sidebarBlocksHtml'];
    }


$data['title'] = (isset($data['title']) && !empty($data['title'])) ? $data['title'] : 'Gallery';

if (isset($data['bodyHtml'])) {

echo $data['bodyHtml'];

}
cyberman

Re: gallery2 user defined tag not working

Post by cyberman »

tim124 wrote: ive been trying to integrate the newest gallery2 into my site for a few days. Ive tried G2mod and some other plug-ins but im having the same problem with all of them.
G2mod in Forge is not ready for CMSms 1.0.x - I've posted a year ago some modifications to get it work. Have tried it last time (1.04) and it's worked for me. Have you found it?

Another thing ist the database layer. Current CMSms version uses adodb lite, gallery2 uses adodb. That's not the same. You have to set it in config.php and must copy adodb version from gallery2 folder to CMSms /lib folder.
tim124
New Member
New Member
Posts: 5
Joined: Wed Apr 25, 2007 11:59 am

Re: gallery2 user defined tag not working

Post by tim124 »

it was the adodb issue, simply copied the folder and changed the confing file,

so the code i included works fine.

does the css inclusion work in G2Mod, i looked at the code and i couldnt really see how it would work.

is there any way a tag could add to the css?
im guessing that only modules can add the css.
cyberman

Re: gallery2 user defined tag not working

Post by cyberman »

Have you tried to create a stylesheet with g2 css and attached it to template?

Normally it should possible to format every content inside CMSms  ::) ...
tim124
New Member
New Member
Posts: 5
Joined: Wed Apr 25, 2007 11:59 am

Re: gallery2 user defined tag not working

Post by tim124 »

Is there no internal way for modules to add to the main css of a page?

adding more css to the template would mean that the css was added to all the pages even though it might only need to be added to one.

When i find the time i would be happy to make a better gallery2 module or improve the current one(s).

On installation it could copy the adodb folder and change the config file.
tim124
New Member
New Member
Posts: 5
Joined: Wed Apr 25, 2007 11:59 am

Re: gallery2 user defined tag not working

Post by tim124 »

i also had to change the

Code: Select all

  $ret = GalleryEmbed::init(array('g2Uri' => '/gallery/', 
				    'embedUri' => '/main.php,
				    'activeUserId' => $uid));
to

Code: Select all

  $ret = GalleryEmbed::init(array('g2Uri' => '/gallery/', 
				    'embedUri' => '/index.php?page=gallery',
				    'activeUserId' => $uid));
This means that when you click images they open up in the same page rather than try and open then in the gallery2 page and fail!
Post Reply

Return to “CMSMS Core”