[SOLVED] Template gives empty output

More
10 years 3 months ago - 10 years 3 months ago #48893 by nowid50
Hello,

I have tried to make a simple json output template. Currently I have those 4 files :

Category.XML
Code:
<?xml version="1.0" encoding="utf-8"?> <form> <author>Nowid50</author> <website>...</website> <email>...</email> <license>GPLv3</license> <version>1.0</version> <release>20 May 2014</release> <description>Category HTML5 layout similar to the Joomla blog layout. Title, description and image are set as category parameters</description> <fields name="attribs"> </fields> <fieldgroups> <group>renderonly</group> </fieldgroups> <csscategory> </csscategory> <jscategory> </jscategory> </form>

Category.PHP
Code:
<?php echo "Category."; ?>

Item.XML
Code:
<?xml version="1.0" encoding="utf-8"?> <form> <author>Nowid50</author> <website>...</website> <email>...</email> <license>GPLv3</license> <version>1.0</version> <release>20 May 2014</release> <description>HTML5 layout</description> <fields name="attribs"> </fields> <fieldgroups> <group>renderonly</group> </fieldgroups> <cssitem> </cssitem> <jsitem> </jsitem> </form>

Item.PHP
Code:
<?php echo "Item"; ?>

So I expect simple outputs. So I input "http://localhost/test/category?tmpl=category&clayout=json"

What I get is an empty page. However if I put a "die()" in the PHP, it outputs correctly but it is not so clean coding.

What am I missing ?

Thanks in advance.
Last edit: 10 years 3 months ago by nowid50.

Please Log in or Create an account to join the conversation.

More
10 years 3 months ago #48897 by nowid50
Silly me ! I was forcing the template "category" but it doesn't exists.

A raw output template like this one :
Raw.PHP (in template folder)
Code:
<?php defined('_JEXEC') or die('Restricted access'); ?><jdoc:include type="component" />

And using "http://localhost/test/category?tmpl=raw&clayout=json", it now works.

I'll be more carefull now on.

For those wanting JSON output like me, you can try this : github.com/Lyquix/flexicontent_templates

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.352 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline