2012-02-15 48 views
0

我有一個perl test.pl頁面發送電子郵件。電子郵件包含一個鏈接到html頁面linkfromTest.html。轉發/使用SQL查詢輸出值從Perl到HTML在交換

(交換是由交換髮展集團主頁提供Perl編寫的基於Web的應用程序框架:http://www.icdevgroup.org/i/dev

但我不得不使用從test.pl「SQL查詢的結果$參考 - > linkofTest.html頁面需要{'outofstock_prod'}'才能運行sql查詢。

test.pl 

$sql = "select OS.id,OS.name,OS.date,OS.customer_email,OS.product as outofstock_prod,OS.salesperson_email,OS.salesperson 
    from outofstock_sku as OS 
    where mail_sent='0' 
    order by OS.id"; 

$ref->{'outofstock_prod'} 
...... 
...... 
print MAIL "More items potentially matched.\n\n"; 
print MAIL "Click here to view more items : http://qqq.qqqq.com/linkfromTest.html\n\n"; 
..... 




linkfromTest.html 


    [query list=1 sql="select P.sku,P.manufacturer,P.category,P.scat,P.description,P.imgid 
       from 
       products AS P LEFT JOIN inventory AS I 
       ON (I.sku = P.sku AND I.status = 'A') 
       WHERE P.manufacturer LIKE '$ref->{'outofstock_prod'}'' 
       LIMIT 0,4;"]  

在此先感謝

回答

0

您可以嘗試在暫存空間中設置一個臨時變量。

在test.pl:

$Tag->tmp('outofstock_prod'); # remove this when done 
$Scratch->{outofstock_prod} = $ref->{outofstock_prod}; 

然後,在linkFromTest.html:

[query list=1 sql="select P.sku,P.manufacturer,P.category,P.scat,P.description,P.imgid 
      from 
      products AS P LEFT JOIN inventory AS I 
      ON (I.sku = P.sku AND I.status = 'A') 
      WHERE P.manufacturer LIKE '[scratch outofstock_prod]' 
      LIMIT 0,4;"] 

(我不知道什麼是$ref,或者說其outofstock_prod字段包含如果它不是。一個字符串,你可能不得不在它之前建立一個字符串,然後將它粘在$Scratch之前。)