is not used any more and exists only for history. Post new tickets on the Github account. n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 14 years ago

Closed 13 years ago

#439 closed enhancement (fixed)

Generic jResponse object (like jResponseText) with the ability to use a template

Reported by: sylozof Owned by: laurentj
Priority: low Milestone:
Component: jelix:core response Version: 1.0.1
Severity: minor Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:


I'd like a jResponse object that allows developpers to create responses of all kind (like a jResponseText) but which can be used with a template.

Because jResponseHTML and jResponseXML can be assigned a template, but what if I want to send parts of HTML code (for an XMLHttpRequest for example) without all the surrounding <head>, <meta> and <body> markup stuff ?

For now it's not possible, and this generic jResponse with templating feature should solve this issue.

Change History (4)

comment:1 Changed 14 years ago by laurentj

To create a piece of HTML, here is the code :


$tpl = new jTpl();

$rep->content = $tpl->fetch('toto','html');

(note the 'html' parameter to says to jTpl that the content is html, so you can use html plugins in your template)

I don't see how this can be simplificated. Let's imagine that $content member is a jTpl object, the example become:


$rep->tpl = 'toto';
$rep->tplType = 'html';

There is not really an advantage here. Do you see other cases where there are some advantages ?

However, we can improve the text response to support natively a jTpl object if it is really necessary..

comment:2 Changed 14 years ago by laurentj

  • Priority changed from normal to low

comment:3 Changed 13 years ago by bballizlife

  • Documentation needed unset

The now existing jResponseHtmlFragment does the job sylozof wants, doesn't it ?

If yes, i think we can close the ticket.

comment:4 Changed 13 years ago by bastnic

  • Resolution set to fixed
  • Status changed from new to closed

I want to close it too.

Note: See TracTickets for help on using tickets.