Home » Forum
NoNumber!

Joomla! extensions & websites
development / support / consultancy

I try to respond within 24 hours (excluding weekends). If I haven't responded by then, feel free to post a reminder or bug me via email.
Welcome, Guest
Please Login or Register.    Lost Password?

Passing parameter to included PHP file
(1 viewing) (1) Guest
Go to bottomPage: 12
TOPIC: Passing parameter to included PHP file
#8667
Passing parameter to included PHP file 4 Months, 3 Weeks ago  
Hi

searched up and down the forums for anything similar... no luck

I am using rereplacer and sourcerer to try and create a tag for our office staff to add a special offer item into an article.

[additem]item_code[/additem]

and i want it to replace this with the php code to add to the cart which is in a php file.

I have
\[additem\](.*?)\[/additem\]


and
{source} [[script type="text/javascript" src="http://code.jquery.com/jquery-1.4.1.min.js"]][[/script]]
[[script type="text/javascript" src="fancybox/jquery.fancybox-1.3.0.pack.js"]][[/script]]
[[script type="text/javascript" src="fancybox/jquery.easing-1.3.pack.js"]][[/script]]
[[link rel="stylesheet" href="fancybox/jquery.fancybox-1.3.0.css" type="text/css" media="screen"]]
[[link rel="stylesheet" href="fancybox/style.css" /]]
[[?php
   $var = \1;
   echo $var;
   //include JPATH_SITE.DS.'mlfsnippets'.DS.'addinc.php';
?]]{/source}



for my search and replace but $var is not being seen in the addinc.php file

Help?

regards
Marco
Marco
Posts: 5
User OfflineClick here to see the profile of this user
Last Edit: 2010/04/21 15:06 By peter.
The administrator has disabled public write access.
 
#8669
Re: Passing parameter to included PHP file 4 Months, 3 Weeks ago  
When using the {source} tags in non-editor fields, use {source 0}...{/source}.

I think the problem is with quotes.
use:
[[?php
   $var = '\1';
   echo $var;
?]]
Peter van Westen
Admin
Posts: 4549
User Online NowClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#8670
Re: Passing parameter to included PHP file 4 Months, 3 Weeks ago  
Thanks for the quick response.

However

the item_code was being echo'ed correctly with and without the '' marks but when $var is being used in the addinc.php file it is failing.

?
Marco
Posts: 5
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#8671
Re: Passing parameter to included PHP file 4 Months, 3 Weeks ago  
My apologies

var is visible in PHP file, must be my code elsewhere

thanks
Marco
Posts: 5
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#8672
Re: Passing parameter to included PHP file 4 Months, 3 Weeks ago  
ok
Peter van Westen
Admin
Posts: 4549
User Online NowClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#8673
Re: Passing parameter to included PHP file 4 Months, 3 Weeks ago  
Can you have two paramters? or more?

e.g. [mytag]val1 val2 val3[/mytag]

and rereplacer them with
<a href="file.html?a=var1&b=var2&c=var3">hello</a>

or something similar?
Marco
Posts: 5
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 12
Joomla Open Source Training