Deze udt roep ik in mijn template aan met:
Code: Select all
{gallery_album album_name="{image->gallery_url}"}
Code: Select all
if ( isset($params['album_name']) ) {
echo $params['album_name']."<br>"; //test de url
$re = '/(?:\?|\&)(?<key>[\w-]+)(?:\=?|)(?<value>[\w.]+)?/';
$str = $params['album_name'];
$count = preg_match_all($re, $str, $matches, PREG_SET_ORDER);
echo "matches found = " . $count . "<br>";
var_dump($matches);
foreach ($matches as $val) {
echo "matched: " . $val[0] . "<br>";
echo "(1) key: " . $val['key'] ."<br>";
echo "(2) Value: " . $val['value'] . "<br><br>";
}
} //end
Code: Select all
http:///www.mijnsite.nl/index.php?mact=Gallery,mdcd5d,default,1&mdcd5ddir=Fotografie%2F&mdcd5dreturnid=1&page=1
matches found = 4
array (size=4)
0 =>
array (size=5)
0 => string '?mact=Gallery' (length=13)
'key' => string 'mact' (length=4)
1 => string 'mact' (length=4)
'value' => string 'Gallery' (length=7)
2 => string 'Gallery' (length=7)
1 =>
array (size=3)
0 => string '&' (length=4)
'key' => string 'amp' (length=3)
1 => string 'amp' (length=3)
2 =>
array (size=3)
0 => string '&' (length=4)
'key' => string 'amp' (length=3)
1 => string 'amp' (length=3)
3 =>
array (size=3)
0 => string '&' (length=4)
'key' => string 'amp' (length=3)
1 => string 'amp' (length=3)
matched: ?mact=Gallery
(1) key: mact
(2) Value: Gallery
matched: &
(1) key: amp
(2) Value:
matched: &
enz.... ook notices vanwege geen 'value'key....
Als ik nu het volgende veranderd werkt het perfect:
Code: Select all
$str = 'http:///www.mijnsite.nl/index.php?mact=Gallery,mdcd5d,default,1&mdcd5ddir=Fotografie%2F&mdcd5dreturnid=1&page=1';
Code: Select all
http:///www.mijnsite.nl/index.php?mact=Gallery,mdcd5d,default,1&mdcd5ddir=Fotografie%2F&mdcd5dreturnid=1&page=1
matches found = 4
array (size=4)
0 =>
array (size=5)
0 => string '?mact=Gallery' (length=13)
'key' => string 'mact' (length=4)
1 => string 'mact' (length=4)
'value' => string 'Gallery' (length=7)
2 => string 'Gallery' (length=7)
1 =>
array (size=5)
0 => string '&mdcd5ddir=Fotografie' (length=21)
'key' => string 'mdcd5ddir' (length=9)
1 => string 'mdcd5ddir' (length=9)
'value' => string 'Fotografie' (length=10)
2 => string 'Fotografie' (length=10)
2 =>
array (size=5)
0 => string '&mdcd5dreturnid=1' (length=17)
'key' => string 'mdcd5dreturnid' (length=14)
1 => string 'mdcd5dreturnid' (length=14)
'value' => string '1' (length=1)
2 => string '1' (length=1)
3 =>
array (size=5)
0 => string '&page=1' (length=7)
'key' => string 'page' (length=4)
1 => string 'page' (length=4)
'value' => string '1' (length=1)
2 => string '1' (length=1)
matched: ?mact=Gallery
(1) key: mact
(2) Value: Gallery
matched: &mdcd5ddir=Fotografie
(1) key: mdcd5ddir
(2) Value: Fotografie
matched: &mdcd5dreturnid=1
(1) key: mdcd5dreturnid
(2) Value: 1
matched: &page=1
(1) key: page
(2) Value: 1
Alleen de url is steeds verschillend dus die moet worden doorgegeven zoals in eerste voorbeeld maar dan werkt het niet?
Ook als ik de 'params['album_name']' direct in preg_match zet werkt het ook niet.
Doe ik nu iets stoms of zie ik wat over het hoofd??
Iemand enig idee?
bvd.