development question
serbanc
Joined: 2006-05-19
Posts: 314 |
Posted: Mon, 2007-11-26 08:41 |
gentlemen, regards, |
|
serbanc
Joined: 2006-05-19
Posts: 314 |
Posted: Mon, 2007-11-26 08:41 |
gentlemen, regards, |
|
Posts: 32509
yes. it's just a matter of specifying the template path when loading the .tpl file.
but the output of TinyMCE isn't a .tpl file, is it?
i guess you'd just store the HTML as a .html or .dat file as a normal g2 item. so you don't have to worry where it's stored. it's stored for you in g2data/albums/.
then you could embed that html in a normal view .tpl of your module.
but if this is really about the HTML item task, let's continue the discussion in your existing thread at http://gallery.menalto.com/node/71171.
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage
Posts: 314
valiant, thank you very much for your answer.
the question is not related to HTML item module.
Story.
I want to develop a module that allows me to put a different page as home page.
Mainly, I managed to develop something, but I hate to go on telnet/ftp to modify the TPL file each time.
So one ideea would be to store a .TPL file somewhere (let's say in g2data dir) and, via some simple administration tool, to be able to edit it (web interface).
serbanc - www.e-poze.ro
Posts: 32509
you could also store the HTML in the database.
@g2data:
each module can store plugin data.
example: the watermark module stores its watermark files at:
$gallery->getConfig('data.gallery.plugins_data') . 'modules/watermark/';
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage
Posts: 314
ok, I am posting the code below.
What I want is to store FrontPage.tpl file somewhere in g2data (details below).
And to be able to load it. the commented return lines are not working. do not know why.
And now, the code:
class FrontPageView extends GalleryView {
/**
* @see GalleryView::loadTemplate
*/
function loadTemplate(&$template, &$form) {
global $gallery;
/* get the default file */
list ($ret, $value) =
GalleryCoreApi::getPluginParameter('module', 'frontpage', 'frontPageFile');
if ($ret) { return array($ret, null); }
$platform =& $gallery->getPlatform();
$slash = $platform->getDirectorySeparator();
$frontpageDir =
$gallery->getConfig('data.gallery.plugins_data') . 'modules/frontpage' . $slash;
$tplFile = $frontPageDir . $value;
// return array(null, array('body' => $tplFile,
// 'useFullScreen' => TRUE));
return array(null, array('body' => 'modules/frontpage/templates/FrontPage.tpl',
'useFullScreen' => TRUE));
}
serbanc - www.e-poze.ro
Posts: 32509
i guess you'd have to smarty->fetch your .tpl separately. then pass the rendered HTML as a param to another template.
(or use an immediate view instead)
alternative 1, normal view:
add a new .tpl at gallery2/modules/frontpage/templates/FrontPage.tpl with the contents:
alternative 2: store the HTML in a plugin parameter instead of storing it as a file:
- create a templates/FrontPage.tpl file as described above.
- change your view accordingly
alternative 3: use an immediate view:
basically like alternative 1 and 2, but instead of assigning the HTML as template variable, you'd just print it out.
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage
Posts: 314
Thanks Valiant,
I will test it asap. let you know about the status.
serbanc - www.e-poze.ro
Posts: 314
Valiant, I used version 1.
Works great, with one exception: I cannot display SystemLinks blocks. Looked into core/...../SystemLinks.tpl and it gets the links from $theme.SystemLinks. I imagine that working with separate template, I will not have the theme variable defined. Now the question: how can I load the SystemLinks for a theme ???
serbanc - www.e-poze.ro
Posts: 314
solved! loaded the default theme!
thanks for your support.
serbanc - www.e-poze.ro
Posts: 314
valiant, thank you very much for your support.
It works perfect!
serbanc - www.e-poze.ro
Posts: 314
Gentlemen,
Managed to finalize some sort of primitive FrontPage module and I would like to share it.
What should I do ?
serbanc - www.e-poze.ro
Posts: 32509
make a zip file and create a new forum topic to announce your module with the zip file attached as forum file attachement.
usually modules are announced in the module development forum. (this will change next year)
also add your module on the wiki pages. downloads -> user contributed modules. and codex.gallery2.org/Gallery2:Modules:yourmoduleid
--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage