Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Pondelok, 30. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  trigger frustration - need a returned variable

phpMyEdit Configuration     trigger frustration - need a returned variable
Odoslať novú tému   Odpovedať na tému    
 
kally     Založený: 05.01.2005   Príspevky: 14  
Príspevok Zaslal: 2007-12-02 12:41
Návrat hore  Odpovedať s citátom     

I've read through every post and documentation I can find and tried countless variations, but nothing seems to be working.
I'm using PME release 5.7.1

I need to populate a dropdown list in Change View with images filenames from a folder where the name of the folder is in the column filename:

$opts['fdd']['thumb']['values']= array('');
$maindir = '../gallery/art/'.$thisFilename ;
$mydir = opendir($maindir) ;
while($fn = readdir($mydir)) {
if ($fn != '.' && $fn != '..'){
if(ereg("^tn", $fn)) {
array_push($opts['fdd']['thumb']['values'],$fn);
}
}
}
closedir($mydir);

I've used this before and it works great when I'm only dealing with one record and am using the filename as a session variable, but with this project the List view displays all of the records in the table and so there is no session variable I can use for $filename.

I wrote a trigger file:
$myrec = $this->rec;
$sql = "SELECT filename FROM artists WHERE artistID = \"$myrec\"";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
{ $thisFilename = $row["filename"]; }
$newvals['thisFilename'] = $thisFilename;
return true;

This is my statement in the main page:
// Before displaying the edit page
$opts['triggers']['update']['pre'] = 'get_filename.inc';

I've echoed the results within the trigger file and am getting the correct results, but cannot find a way to use the variable outside of the trigger file. Either nothing is being returned or I am not using the correct syntax. I've tried every variation I can think of. An echo of the variable on the main page is empty.

This is the column array for filename:

$opts['fdd']['filename'] = array(
'name' => 'folder name',
'select' => 'T',
'maxlen' => 20,
'required' => true,
'sort' => true
);

That's all of the information I can think of. What am I doing wrong?
Thanks!
Kally

 
kally     Založený: 05.01.2005   Príspevky: 14  
Príspevok Zaslal: 2007-12-02 23:15
Návrat hore  Odpovedať s citátom     

I solved it by going back to session variables. I set the Session variable in the trigger file:

Kód:

$myrec = $this->rec;
$sql = "SELECT filename FROM artists WHERE artistID = \"$myrec\"";
$result = mysql_query($sql);   
while ($row = mysql_fetch_array($result))
{
$thisFilename = $row["filename"];
}
if(!isset($_SESSION['thisFilename'])) {   
    $_SESSION['thisFilename'] = $thisFilename; }

return true;


It seems that there must be a way to do this along the lines of how I started out, but I can't figure out how. I still need to insert something to kill the session when I go back to List View, but that should be easy enough. I'm already using IF statements for different views.

Hope this can help someone else.
Kally

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov