Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Bug in template parsing or...
Hello,
I’m trying to achieve a new txp-plugin and i’m stuck on a problem.
Here’s a part of the code :
<code>
$form = (empty($form)) ? “picture_form” : $form;
$form_content = fetch(‘Form’, ‘txp_form’, “name”, $form);
$preg = preg_match_all($flapsreg, $form_content, $placeholders, PREG_PATTERN_ORDER);
$h_list = array_keys(array_flip($placeholders[‘0’])); $ph_list = array_keys(array_flip($placeholders[‘1’]));
$sql = “photos.id AS id, photos.excerpt AS description, photos.location AS location, photos.equipment AS equipment, photos.title AS name, photos.file AS image, photos.thumbnail AS thumb, albums.title AS album, albums.excerpt AS excerpt”; $as = “fla_photos AS photos, fla_photoalbums AS albums”;
$sq = “(photos.id = ‘$id’)”;
$photo = safe_row($sql, $as, $sq, FGY_DEBUG);
foreach ($ph_list as $value) {
$values[] = $photo[$value];
}
$outer = str_replace($h_list, $values, $form_content);
</code>
When outputting it with a simple “echo $outer;” I get the content of the string (HTML with content), but if I write “return $outer;” the outputted code will be HTML without the content filled by the str_replace…
Any idea ??? Is there something special to know ?
Offline
Re: Bug in template parsing or...
Seems to be a bug with the “safe_row” function.
If I use safe_row instead of getRow, it returns an additionnal blank array. What is this blank array for ? What are the differences between safe_row and getRow (the call arguments and ??) ????
Thanks for anything that would help…
Offline
Pages: 1