Content Bloom Experience

advertisement
Tridion and PHP Don’t Mix
…or Do They?
Abstract
• Using PHP and Dynamic Publishing, the
considerations and the limitations of using
PHP via OData v.s. .NET or Java.
• I will show some sample code and discuss the
kind of TCDL handlers that need to be
developed, and the difficulty/ease of doing so.
About Us
• A lot of credit goes to Jon Primmer for getting much of the
technical detail
• Feel free to reach out:
– Jon Primmer: @jonnybeemud ; j.primmer@contentbloom.com
– Nick Roussakov: @nroussakov ; nick@contentbloom.com
Why PHP, all of a sudden?
•
We recently had a few customers request Tridion integrations with their PHP front-end
applications.
•
PHP is free and has a plethora of open-source products starting to seep into the enterprise. For
example:
–
–
–
–
–
–
–
•
•
•
•
Magento e-comm platform
Drupal
Wordpress
SugarCRM
Silverstripe
CodeIgniter MVC framework
Has frameworks to do just about everything (even LINQ - http://phplinq.codeplex.com/)
PHP version 5.3 has very robust OOP capability
Coding PHP doesn’t suck any more.
Eclipse with IntelliSense works great
Xdebug
So how do you integrate a PHP solution
with SDL Tridion?
• Our first thought: “Static Publishing”
– Render any kind of text file and place it on the host server.
– Get creative with “include” files.
• For example, a Page in Tridion with a set of Component Presentations published as an
“include” file gives another level for nesting Component Presentations.
• What if we need to have the ability to target content based on, say,
taxonomy (keywords or custom metadata)?
– Have taxonomy-driven navigation
– Quicker (more efficient) way to update and publish content
– Share published content from a single source
• … and so we explore Tridion’s Dynamic Content Delivery
Dynamic Content Delivery Options for
non-Java/.NET Web Apps
• Traditionally, Tridion’s Dynamic Delivery was
available for Java and .NET -based applications
• This meant having to create a custom wrapper
around the Java or .NET APIs
• With SDL Tridion 2011 a new Content Delivery
Web service is available (a.k.a. Tridion Odata)
• (There is also REL)
"You mean I finally have frickin'
sharks with frickin' laser beams
attached to their frickin' heads?"
Odata Sample Output
Consuming the Dynamic Content
• In our page template we frequently use this code:
• When the output format and delivery target
language are set to REL, we get the following on our
php page:
Consuming the Dynamic Content (cont.)
• All we need now is a Tridion Building Block that will catch this
during publishing and replace it with PHP code to call oData
Optimizing oData Calls
• Odata querying just the right amount of data:
– Does filtering via LINQ require sending too much across the wire (e.g.
/ComponentPresentations returns all the CPs from the Broker and filtering on
application side)?
• No. See http://msdn.microsoft.com/en-us/library/ee622463.aspx
• What about with Java or PHP?
– Need to fine-tune our Odata queries using $filter, $expand
– E.g. Get Component Presentations where CustomMeta key = “foo”, such that
the fewest number of HTTP Requests go out.
• The answer: caching
– Tridion’s Cache Channel Service on top of oData
– A caching appliance
– Application-level caching, e.g. CodeIgniter Cache
(https://github.com/philsturgeon/codeigniter-cache)
Make the Odata Query as Drilled Down as
Possible
QueryOne: ComponentPresentations based on component custom meta field
-----------------http://localhost:82/odata.svc/CustomMetas?$filter=StringValueeq%20%27Golf%27&$expand=Co
mponent/ComponentPresentations
QueryTwo: All custom meta of componet presentations based on a specific template
-----------------localhost:82/odata.svc/ComponentPresentations?$filter=TemplateId eq 666 and publicationId eq
8&$expand=Component/CustomMetas
Sample Output
What About Add-on Modules and
Products?
• Tridion Experience Manager (the new SiteEdit)
• Profiling and Personalization
• Fredhopper
Tridion Experience Manager
• The staging site runs in an iFrame, so technically it can
be on any language platform (PHP, python, whatever)
• The caveat is Session Preview, which requires the
staging site to be able to run Java (Content Delivery API
and Ambient Data Framework jars).
– Possible to run PHP on a Java App server, e.g.:
– Tomcat AJP Connector: http://tomcat.apache.org/tomcat3.2-doc/tomcat-apache-howto.html
– or PHP to Java Bridge: http://php-javabridge.sourceforge.net/doc/tomcat6.php
– This is still in experimental stages
Profiling and Personalization
• Tridion offers the ability to set up Target
Groups based on keyword tracking and other
criteria
• Unfortunately this requires storing cookies on
the client machine. The Contenet Delivery
Web Service can’t do that.
• Good news: we can build our own…
Profiling and Personalization
• A custom TCDL handler can be created to translate the target
group syntax into PHP code, which talks to the Broker
Fredhopper
• SmartTarget is the product that integrates
Fredhopper with Tridion.
• The Ambient Data Framework is used in between
• For PHP integration, a custom solution can be
built on top of Fredhopper’s web service APIs.
• Probably can’t make it as good as SDL’s ADF, but
possible to make it good-enough for the
immediate functionality required.
Thanks
• Questions?
About Content Bloom
• Offices in Toronto, Brussels and UK
• Certified SDL Tridion consultancy and partner
• Strong knowledge and deep roots within the
SDL Tridion product suite
Download