Php function on xsl page
This is an open discussion with 11 replies, filed under General.
Search
here something found?
@Sana It would be easier for people to help you if they could see the XSL and PHP you have written.
@Sana, using Symphony you should hardly ever include PHP in Templates. Whenever possible, use (custom) datasources and events, but try and keep your templates clean (XSLT).
Hi ,
i called php function on xsl page- using registerfunctions on extension. i got output, but using jquery script (jquery clicks on this php function )on this php function not working on frontend. i given registerfunction like this, and this register function calling hello_world
public function getSubscribedDelegates(){
return array(
array(
'page' => '/frontend/',
'delegate' => 'FrontendOutputPreGenerate',
'callback' => 'registerFunctions'
),
any suggestion ??
In between: @Sana, can you also tell what functionality do you want to achieve? What service do you implement or what should be the overall results?
hi, I was following "How to Register and Use Custom PHP Functions Inside XSL" example and created my own extension under my-site/extensions/myextensions/extension.driver.php.
like same as
http://pastie.org/3329575
and called this helloworld in home.xsl
like xsl:value-of select="php:function('helloworld','')"
on top of this xsl page included
xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:php="http://php.net/xsl"
xmlns="http://www.w3.org/1999/xhtml"
echo part of this php function showing - but in this php function have onclick and other js work , i can't to add script js on this extension.driver.php
http://pastie.org/3329575
There is no onclick functionality in the function example you provided us. Please provide details as to what you want to achieve, with full examples where possible (minus any sensitive data) and we can then help you solve your problem.
Hi designermonkey, i was used,
<script language="javascript" type="text/javascript">
$(document).ready(function($) {
$(".category").click(function() {
var path = '<?php echo EXTENSIONS . "/excategory/sub.php"?>';
var url = '' ;
$.ajax({
url: path,
type: "POST",
data :{'url' :url},
success: function(response){ alert(response);
document.getElementById('row main-list').innerHTML= "";
document.getElementById('rowcategorylist').innerHTML= response;
}
});
});
});
</script>
using this 'excategory' extension showing 'main category' on frontend and using this script trying to show their 'sub categories' but this post page is not working for me .
Hi Sana,
thanks for sticking with us and providing further examples.
One more information we are still missing to help you out and that is the general information of what do you try to achieve.
As an example of what I mean:
- A navigation menu for your Symphony-based web site
- List of product categories (or news articles categories etc.) defined in your Symphony CMS to display onto its frontend
- Pulling some data from an external web site or external service into your Symphony-based web site to display on its frontend
Something like this. Can you specify?
We need to know better the environment of what you are working on. 'Cause we want to make sure that you have successfully utilized existing natively supported Symphony features like XSL frontend templating
, datasource
utilization etc., so to say the true power, beauty and flexibility of Symphony.
All the best and let us know!
Ok.Thank you.
You are welcome.
Create an account or sign in to comment.
Hi ,
My doubt is that ' i called one php function in home.xsl page ' - and also included xmlns:php on top xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:php="http://php.net/xsl
but in this page displayed that php function's output , but didn't displaying other apply-templates ... why ? How i can displaying both php output and other apply-templates ?