Page 1 of 1
writeDescription for current folder in templates ?
Posted: Wed Jul 27, 2011 10:30 pm
by jardinphoto
I'm designing a template for Admiror Gallery and would like to use current folder description in a specific DIV.
What I need is something like writeDescription function for current gallery folder.
The idea is having a function that allows to call current gallery description in the php file of the template.
Any idea ?
Sebastien
P.S. : thanks for this great joomla extension (and I tried many gallery plugins for joomla).
Re: writeDescription for current folder in templates ?
Posted: Fri Jul 29, 2011 8:26 am
by kekeljevic
This is so simple...

Here You go:
Code: Select all
$lang =& JFactory::getLanguage();
$langTag=strtolower($lang->getTag());
$folderDesc = "";
$ag_pathWithStripExt=dirname($AG->imagesFolderPhysicalPath).DS.$AG->imagesFolderName;
$ag_XML_path=$ag_pathWithStripExt.".XML";
if(file_exists($ag_pathWithStripExt.".xml")){
$ag_XML_path=$ag_pathWithStripExt.".xml";
}
$ag_XML_xml = & JFactory::getXMLParser( 'simple' );
$ag_XML_xml->loadFile($ag_XML_path);
$ag_XML_captions =& $ag_XML_xml->document->captions[0];
// GET DEFAULT LABEL
if(!empty($ag_XML_captions->caption)){
foreach($ag_XML_captions->caption as $ag_XML_caption){
if(strtolower($ag_XML_caption->attributes('lang')) == "default"){
$folderDesc = $ag_XML_caption->data();
}
}
}
// GET CURRENT LANG LABEL
if(!empty($ag_XML_captions->caption)){
foreach($ag_XML_captions->caption as $ag_XML_caption){
if(strtolower($ag_XML_caption->attributes('lang')) == strtolower($langTag)){
$folderDesc = $ag_XML_caption->data();
}
}
}
// RICH TEXT SUPPORT
if($AG->params['plainTextCaptions']){
$folderDesc = strip_tags($folderDesc);
}
$html.=$folderDesc;
Re: writeDescription for current folder in templates ?
Posted: Fri Jul 29, 2011 2:07 pm
by Vasiljevski
This could go to API part of agGallery.php

Re: writeDescription for current folder in templates ?
Posted: Fri Jul 29, 2011 11:27 pm
by jardinphoto
That would be a great idea !
@kekeljevic : thank you so much for your answer. I wasn't able to have it work for the moment but I'm searching ....
Something like AG->writeGalleryDescription would be a great addon

Re: writeDescription for current folder in templates ?
Posted: Mon Aug 01, 2011 8:33 am
by kekeljevic
We all agree with this
