Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-10-25 18:02:19

Tournesol
New Member
From: Paris, France
Registered: 2004-07-28
Posts: 5
Website

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

#2 2004-10-25 18:54:45

Tournesol
New Member
From: Paris, France
Registered: 2004-07-28
Posts: 5
Website

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

Board footer

Powered by FluxBB