As per this thread: http://get-simple.info/forums/showthread.php?tid=6369
I'm trying to use the Search plugin for generating a list of teasers for specific pages in a template. Thanks to mvlcek's reply and after a little bit of code diving, I came up with this:
]
This gets the desired results. Is there anything problematic / depreciated in this approach that escapes my novice eyes?
Secondly, should I worry about performance? If yes, what would be a good way to caching here?
And thirdly, before I dive into it: would the same approach work with the Custom Fields plugin? Because, while a 'special page' is the right thing in the approach above, for my other needs it would be more elegant/semantically correct to just enhance normal GetSimple CMS pages with a custom field.
EDIT: I think, the "$page_data = getXml(GSDATAPAGESPATH" line is superfluous, but it's definitely too late here and I'm going to bed now.
I'm trying to use the Search plugin for generating a list of teasers for specific pages in a template. Thanks to mvlcek's reply and after a little bit of code diving, I came up with this:
PHP Code:
<div class="modules-list">
<h2 class="sixteen columns">Unsere Module</h2>
<?php
$results=return_i18n_search_results('_special_modul', ' ')['results'];
$counter=1;
foreach($results as $item) {
$page_data = getXml(GSDATAPAGESPATH . $item->id . '.xml');
?>
<div class="module teaser one-third column <?php ($counter++ % 2) == 0 ? print 'even' : print 'odd'?>">
<div class="teaser-image"><img src="<?=$item->image1?>" /></div>
<div class="teaser-text">
<a href="<?php get_theme_url();?>/<?=$item->url?>"><h3><?=$item->title?></h3></a>
<p><?=$item->subtitle?></p>
</div>
</div>
<?php } ?>
</div>
[/php
This gets the desired results. Is there anything problematic / depreciated in this approach that escapes my novice eyes?
Secondly, should I worry about performance? If yes, what would be a good way to caching here?
And thirdly, before I dive into it: would the same approach work with the Custom Fields plugin? Because, while a 'special page' is the right thing in the approach above, for my other needs it would be more elegant/semantically correct to just enhance normal GetSimple CMS pages with a custom field.
EDIT: I think, the "$page_data = getXml(GSDATAPAGESPATH" line is superfluous, but it's definitely too late here and I'm going to bed now.