This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » plugins » General plug-ins » [sfXSLTViewPlugin] First release
[sfXSLTViewPlugin] First release [message #34809] Mon, 03 September 2007 11:04 Go to next message
johnwards  is currently offline johnwards
Messages: 52
Registered: August 2007
Location: Oxford
Member
Well hello...

Right my first go at a symfony plugin.

http://trac.symfony-project.com/trac/wiki/sfXSLTViewPlugin

This provides XSL templates for symfony.

The parent node on the XML is called "XML"

If you have this plugin installed it will use the XML method it provides to turn Propel models to XML otherwise it uses the toArray method on your propel model. It wraps all string data in CDATA tags, it tests to see if a string is numeric first however.

As part of the plugin another class called sfArray2XML which does exactly what is says on the tin.

Well have a play and please give me feedback.

Re: [sfXSLTViewPlugin] First release [message #34842 is a reply to message #34809 ] Mon, 03 September 2007 20:11 Go to previous messageGo to next message
francois  is currently offline francois
Messages: 1636
Registered: October 2005
Faithful Member
Usage guidelines and examples would be welcome...
Re: [sfXSLTViewPlugin] First release [message #34848 is a reply to message #34842 ] Mon, 03 September 2007 21:11 Go to previous messageGo to next message
johnwards  is currently offline johnwards
Messages: 52
Registered: August 2007
Location: Oxford
Member
In the plugin folder there is a folder called examples.

This has a "vidsSuccess.xsl" and a "layout.xsl" file.

This is based on my first site with Xslt.

Which is here

I am new to XSL templates as I have only been working with them for 3 months with my new company and have picked up how they do things which may or may not be the "correct" way of doing templates...but it works.

So the above application is routed to pass a "tag" to the vids action in the above case "montrosefc". This gets the "Job" for montrosefc.

In my action.class.php I assign my variable as I would normally:
$this->Job = A propel model called Job

I also assign an array of Job videos.

The XML this returns is this:
<XML>
- <Job>
  <id>6</id> 
  <category_id>5</category_id> 
  <companyname>Montrose F.C.</companyname> 
  <email>example@example.com</email> 
  <video_title>The Mighty Mo</video_title> 
  <client_name>John Wards</client_name> 
  <client_info>Montrose FC in the cup against Stirling.</client_info>   <client_logo>dd89494255a35a75134da8275cdd06eb.gif</client_logo> 
  <client_tag>montrosefc</client_tag>  
  <created_at>2007-08-23 16:48:54</created_at> 
  <uuid>66da309e-8c75-e7e4-e5e5-f39f544abf14</uuid> 
  <version>4</version> 
  <deleted_at /> 
  </Job>
- <Videofiles>
- <Videofile>
- <![CDATA[ data/jobs/6/mightymo.flv  ]]> 
  </Videofile>
  </Videofiles>
</XML>


If your application is in "debug" mode you can see the raw XML by passing the "GET" variable on your url dumpXML=1

How I work with this XML document is by including "layout.xsl" in the vidsSuccess.xsl file. This is like the layout.php file and you can store it in the same location if you wish by using ../ etc to navigate back to the correct location.

In vidsSuccess.xsl I match the root "/" of the XML document to my "header template" which contains my <html> <head> <body> tags etc. Within my header template i then match the XML node to the template defined in vidsSuccess.xsl. If you know XSL you should be able to follow all this...if not this is not the place to learn it Smile
Re: [sfXSLTViewPlugin] First release [message #34850 is a reply to message #34809 ] Mon, 03 September 2007 21:23 Go to previous messageGo to next message
johnwards  is currently offline johnwards
Messages: 52
Registered: August 2007
Location: Oxford
Member
Oh also PHP functions are avaliable within the templates. So if you can figure out how to use them you can. The manual for this is here...my example XSL templates are setup with the correct name space.

http://uk.php.net/manual/en/function.xsl-xsltprocessor-regis ter-php-functions.php
Re: [sfXSLTViewPlugin] First release [message #37732 is a reply to message #34850 ] Fri, 19 October 2007 10:21 Go to previous messageGo to next message
SpasmodicMonk  is currently offline SpasmodicMonk
Messages: 11
Registered: October 2007
Junior Member
Hi, I'd really like to use this plugin and have had a good crack at getting it to work.

However, nothing I try seems to work right.

All I want is to write out a page that says "Hello world."

My application looks like :-

/apps
--/frontend
----/modules
------/test
--------/templates
----------indexSuccess.xsl
----/templates
------layout.xsl

When I go to http://mydomain/test, I get a stacktrace error reporting "indexSuccess.xsl does not exist in:" (no actual path name follows).

Would it be possible for you to write a quick-start readme like that provided with the sfSmartyViewPlugin? ( http://www.symfony-project.com/trac/attachment/wiki/sfSmarty ViewPlugin/README.pdf?format=raw)

Thanks,

Ian.

[Updated on: Fri, 19 October 2007 10:22]

Re: [sfXSLTViewPlugin] First release [message #37734 is a reply to message #34809 ] Fri, 19 October 2007 10:33 Go to previous messageGo to next message
johnwards  is currently offline johnwards
Messages: 52
Registered: August 2007
Location: Oxford
Member
Morning...good to know that someones giving it a go.

We're using it in a major project at the moment...so it does work....might be a bit rough. We have made a few changes which have yet to be committed in.

It maybe simpler if you uploaded your project to a zip for me to take a look at...if not then your module folder and your app templates folder.
Re: [sfXSLTViewPlugin] First release [message #37743 is a reply to message #37734 ] Fri, 19 October 2007 11:40 Go to previous messageGo to next message
SpasmodicMonk  is currently offline SpasmodicMonk
Messages: 11
Registered: October 2007
Junior Member
Hi, it's good to know that you are using this on a major project. That's what we intend to do with it too.

I have included a zipfile of my apps folder. I can post the contents of my entire modules folder if you need it.

Thanks for your help.

  • Attachment: apps.zip
    (Size: 24.78KB, Downloaded 190 time(s))

Re: [sfXSLTViewPlugin] First release [message #37744 is a reply to message #37743 ] Fri, 19 October 2007 11:47 Go to previous messageGo to next message
johnwards  is currently offline johnwards
Messages: 52
Registered: August 2007
Location: Oxford
Member
I'll try and remember to take a look at this later.

Currently neck deep in Javascript nightmares Sad
Re: [sfXSLTViewPlugin] First release [message #40377 is a reply to message #34809 ] Tue, 27 November 2007 15:05 Go to previous messageGo to next message
johnwards  is currently offline johnwards
Messages: 52
Registered: August 2007
Location: Oxford
Member
Hi,

Sorry about the delay in getting back to you.

Right spotted the issue straight away. You don't have an indexSuccess.xsl file in your test app.

Rename the example "vidsSuccess.xsl" that comes with the example one and using the updated README change the include path to your layout.xsl.

Cheers
John
Re: [sfXSLTViewPlugin] First release [message #67752 is a reply to message #40377 ] Mon, 15 December 2008 11:46 Go to previous messageGo to next message
Cezar708  is currently offline Cezar708
Messages: 20
Registered: August 2007
Location: Poland
Junior Member
Hi,

I've got a this version of symfony:
$ symfony --version
symfony version 1.1.1 (/usr/share/php/symfony)


when I try to install sfXSLTViewPlugin a message occurs:
$ sudo php symfony plugin-install http://plugins.symfony-project.org/sfXSLTViewPlugin
                                                                                               
  You try to install a symfony 1.0 plugin.                                                                       
  Please read the help message of this task to know how to install a plugin for the current version of symfony.                                         


Is possible to install sfXSLTViewPlugin on symfony 1.1?
How to do that?

Thanks
Cezar708
Re: [sfXSLTViewPlugin] First release [message #67756 is a reply to message #34809 ] Mon, 15 December 2008 12:06 Go to previous messageGo to next message
johnwards  is currently offline johnwards
Messages: 52
Registered: August 2007
Location: Oxford
Member
Hi,

We are planning on redeveloping it for symfony 1.2 in the near future.

Not planning on 1.1 support unless it is easy to backport.

If you can start development on it if you like.

Cheers
John

[Updated on: Mon, 15 December 2008 12:07]

Re: [sfXSLTViewPlugin] First release [message #68401 is a reply to message #34809 ] Mon, 22 December 2008 18:01 Go to previous messageGo to next message
johnwards  is currently offline johnwards
Messages: 52
Registered: August 2007
Location: Oxford
Member
I have commited in my first fixes for the symfony 1.2 into trunk today.

I will role out a release in the morning.
Re: [sfXSLTViewPlugin] First release [message #68450 is a reply to message #34809 ] Tue, 23 December 2008 09:43 Go to previous messageGo to next message
Cezar708  is currently offline Cezar708
Messages: 20
Registered: August 2007
Location: Poland
Junior Member
Hi,

You've got a good news for me Wink.

Thanks and Merry Christmas
Cezar708
Re: [sfXSLTViewPlugin] First release [message #68466 is a reply to message #68450 ] Tue, 23 December 2008 12:46 Go to previous message
johnwards  is currently offline johnwards
Messages: 52
Registered: August 2007
Location: Oxford
Member
I won't have time to roll a release until the new year.

However you can get it out of svn if you want.
Previous Topic:sfYzAjaxValidationPlugin Support Page
Next Topic:SfThumbnail problem
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software