Author
|
Message
|
Alex Jones
|
Tuesday 09 September 2003 2:35:22 pm
Well, I have tried to follow the directions listed at http://ez.no/developer/ez_publish_3/documentation/customization/tips_tricks/how_can_i_use_my_own_php_script_inside_ezp and am running into problems. For the moment I am trying to do the simplest possible thing: assign a value to a variable. Here is the code I have added to the top of index.php:
ob_start(); # start output buffering
echo "output";# put your output script here
$AlexVariable = ob_get_contents(); # store the output in $variable ob_end_clean(); # clean output buffering I have also added {$AlexVariable} to my templates but nothing shows up. I have made sure to clear the caches. What I need to do is a bit more complicated (grabbing some GET variables form the URL), I figured I'd keep it easy. But I am stumped. What am I missing? Help would be greatly appreciated. Alex
Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]
<i>When in doubt, clear the cache.</i>
|
Paul Forsyth
|
Wednesday 10 September 2003 12:17:41 am
Alex, There is a better guide at the bottom of that doco for making operators: http://ez.no/developer/ez_publish_3/documentation/customization/tips_tricks/including_php_files_in_templates I thought you had coded operators before? What are you trying to do? Your {$AlexVariable} as it stands will not make into the php. Only via POST or GET will do this. Remember that the template system is itself php code and what you see as html is simply the results of the php code running, so a call of {$AlexVariable} will try and display something that hasn't been set.... Hope this makes sense. Paul
|
Alex Jones
|
Wednesday 10 September 2003 7:47:07 am
I will try the alternate operator idea. What I am trying to do is grab some URL parameters (GET) that are passed to the page which I need to pass to the source attribute of an iframe. You mention that it would have to use POST or GET, but how do I actually grab those? I tried using: $SearchQ = $HTTP_GET_VARS['q']; instead of the echo line, but it doesn't work either. I was hoping for a fast solution to avoid having to write an operator for this, but it appears that I may not have a choice. Alex
Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]
<i>When in doubt, clear the cache.</i>
|
Paul Forsyth
|
Wednesday 10 September 2003 8:14:44 am
Have you had a look at Paul B's ezenv contribution? It may be of use to you in this case. Paul
|
Alex Jones
|
Wednesday 10 September 2003 8:37:15 am
I took a look at it, but as it requires that ViewCaching be disabled it isn't a viable option. The alternate PHP insert instructions are great and I was able to add it. The problem is, I am unable to grab the variables in the URL of the page from within the inserted script. Perhaps they are being translated/stripped by eZ Publish? Alex
Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]
<i>When in doubt, clear the cache.</i>
|
Paul Borgermans
|
Wednesday 10 September 2003 8:41:54 am
>I took a look at it, but as it requires that ViewCaching >be disabled it isn't a viable option. Correct, i only use it in only one occasion where I have no other option.
>The problem is, I am unable to grab the variables in
>the URL form the isnerted script. Perhaps they are >being translated by eZ Publish? No, the problem is that the content (including post/get variables if any) do not reach your script: its in the view cache. It will only work the first time with a cleared cache. -paul
eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans
|
Alex Jones
|
Wednesday 10 September 2003 11:17:18 am
Ahhh, that makes sense. :) Thanks for the explanation Paul. Alex
Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]
<i>When in doubt, clear the cache.</i>
|
John Mina
|
Wednesday 26 May 2004 1:36:29 am
HI Alex, Hi Paul Actually i am trying to get a variable through get method i have the variabel written in the address bar as ?part=2
i want to this variable in the article tpl. i read the words you wrote above here, but i felt lost:( also when i read the 2 links
can you please let me knwo in simple way how to do it , as i am not PHP expert. i have to admit this
so pelease help
Thanks
Sincerely John Mina
|
Tony Wood
|
Wednesday 26 May 2004 2:31:20 am
Try the callme function.
Code can be found here http://pubsvn.ez.no/community/trunk/extension/callme/ Readme is here http://pubsvn.ez.no/community/trunk/extension/callme/readme.txt We have been using this method until eZ enable this feature by default
tony
-- http://www.visionwt.com
Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development
Power to the Editor!
Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future
|
John Mina
|
Wednesday 26 May 2004 3:12:51 am
hi Tony
i do appricaite your try to help me
but where could i downlaod the module from to extract it, or jsut save the php fiels?
can u please do me a favour, i needto pass a parameter, with an integer value through the get method. can u please write simple steps to follow John Mina
|
John Mina
|
Wednesday 26 May 2004 3:34:00 am
HI Tony,
I activated the extension you sent me
so now?
how would icustomize the callme extension to enable me pass this value Sincerely
|
Tony Wood
|
Wednesday 26 May 2004 4:56:06 am
All you do is add the ?about=test to your button or link and then you can gather it using the callme module. Here is an example of its use on a "callme" button
Context: http://www.pobox.co.uk/index.php/services/isp/email_accounts/email_mailboxes Callme Page: http://www.pobox.co.uk/callme/callme?about=Email%20Mailboxes The code is tiny but you can modify it to get the effect you need. I would ask that if you add functionality to it please submit the changes so we can all benefit. I hope this helps
tony
-- http://www.visionwt.com
Tony Wood : twitter.com/tonywood
Vision with Technology
Experts in eZ Publish consulting & development
Power to the Editor!
Free eZ Training : http://www.VisionWT.com/training
eZ Future Podcast : http://www.VisionWT.com/eZ-Future
|