mvlcek Wrote:vasitellapahki Wrote:mvlcek Wrote:I18N Gallery only works, if included in the content of normal pages, because I18N Gallery needs to know already in the header, which gallery is to be included for additional scripts and styles to be included. On the news page the content is empty - thus no substitution takes part.
Thank you.
Any suggestions what extension (or other solution) to use for gallery in news postings?
I like I18N gallery, I'd prefer that, but if it's not possible, well I guess then I must install another gallery extension for galleries in news postings... or is it possible at all to add galleries to news postings with extension?
If News Manager offers a function to get the content of the news item as string, you can use the attached I18N Gallery plugin together with the following code in the template in the HTML head:
As I don't use the News Manager, I don't know which functions to call.Code:<?php
if (return_page_slug() == ...) { # check, if we are on the news page and a single news item is displayed
$newscontent = ...; # get news content as string
get_i18n_gallery_header_from_content($newscontent);
}
?>
(I'm creating normal pages for news items and tagging them with _news - for the display I use the I18N Search plugin)
I'm able to get the news content and the related gallery header appears correctly (it loads related js and css), but the substitution still doesn't takes part. is something missing?
basically:
- plugins/news_manager/inc/site.php
added this function
Code:
function nm_get_post($slug, $excerpt=false) {
$file = NMPOSTPATH . "$slug.xml";
$post = @getXML($file);
if (!empty($post) && $post->private != 'Y') {
$content = strip_decode($post->content);
return $content;
}
}
- theme/yourtheme/header.php
added before </head>, to see if works with a specified gallery
Code:
<?php
$page = return_page_slug();
if($page == 'news') {
$newscontent = nm_get_post('gallery-something');
get_i18n_gallery_header_from_content($newscontent);
}
?>
- in the news content
some text, bla bla
(% GALLERY NAME=GALLERY-SOMETHING %)