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

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#938 closed new feature (fixed)

Create a jfullurl tpl plugin to get the absolute url

Reported by: mike Owned by: mike
Priority: low Milestone: Jelix 1.2 beta
Component: jelix:plugins:tpl Version: trunk
Severity: trivial Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description

In some cases like email templates, it's useful to use links with the full url including the domain name in order to get back on the website.

Instead of getting only "/index.php/module/controller/action" with jurl plugin, I would like to be able to retrieve "http://mydomain.com/index.php/module/controller/action".

It would works like {jurl} but with minor changes:

Use cases:

1) if you want to locally set a domain name

{jfullurl 'module~controller:action', array('param1'=>'value1'), "mydomain.com"}

2) if you want to use the default domain, set domainName = "mydomain.com" in default.conf.ini.php

{jfullurl 'module~controller:action', array('param1'=>'value1')}

3) if you want to use the $_SERVER[SERVER_NAME] value

{jfullurl 'module~controller:action', array('param1'=>'value1')}

Attachments (1)

patch_938_v1.diff (3.0 KB) - added by mike 11 years ago.
the first patch, try it!

Download all attachments as: .zip

Change History (18)

Changed 11 years ago by mike

the first patch, try it!

comment:1 Changed 11 years ago by laurentj

  • Milestone changed from Jelix 1.3 to Jelix 1.2

comment:2 Changed 11 years ago by mike

  • review set to review?

comment:3 Changed 11 years ago by bballizlife

I will review+ soon as the patch is ok for me. But i would like to discuss something before. Do jurlfull and jurl plugins have to be "html" plugins ?

If we want to display an url in a text email, we cannot make use of the plugins. What do you think about that jelixians ?

comment:4 Changed 11 years ago by laurentj

  • review changed from review? to review+

ok for me.

@bballizlife : there is already a jurl plugin for text ;-). We could have this jurlfull for text too...

comment:5 follow-up: Changed 11 years ago by bballizlife

@laurentj : erf... i looked at the reference API before but i did not see the plugins. Too bad. Indeed they already exists so it's ok.

I suggest to add the jurlfull in text and xul (as jurl exists there too).

comment:6 in reply to: ↑ 5 Changed 11 years ago by mike

Replying to bballizlife:

@laurentj : erf... i looked at the reference API before but i did not see the plugins. Too bad. Indeed they already exists so it's ok.

I suggest to add the jurlfull in text and xul (as jurl exists there too).

I can provide the patch with the text and xul version, but what about having it in the common directory ? Isn't it better ?

comment:7 Changed 11 years ago by bballizlife

indeed, i don't see any drawbacks to have it only in "common". Maybe laurentj have some reason but if not this would be easier to maintain one version in one directory.

comment:8 follow-up: Changed 11 years ago by laurentj

there is a little difference between text and html : in text, the url is not escaped (htmlspecialchars etc..). If you look at jurl plugins between text and html, you will see a difference in parameters. however, for xul, no difference with html

comment:9 in reply to: ↑ 8 Changed 11 years ago by mike

Replying to laurentj:

there is a little difference between text and html : in text, the url is not escaped (htmlspecialchars etc..). If you look at jurl plugins between text and html, you will see a difference in parameters. however, for xul, no difference with html

Maybe we can detect the response type ?! And not escape the string for text and it will be alright!

Am I right?

comment:10 follow-ups: Changed 11 years ago by laurentj

not the response type but the type asked by jTpl. I think we have a property for that on the object $tpl given to the function, I don't remember.

comment:11 in reply to: ↑ 10 Changed 11 years ago by mike

I will check that and give another patch as soon as possible!

comment:12 in reply to: ↑ 10 ; follow-up: Changed 11 years ago by mike

Replying to laurentj:

not the response type but the type asked by jTpl. I think we have a property for that on the object $tpl given to the function, I don't remember.

Apparently we cannot have access to the property "$outputType" since it's in the jTplCompiler and not in the jTpl object... If you have any idea on how retrieve this value...

comment:13 in reply to: ↑ 12 Changed 11 years ago by foxmask

Replying to mike:

Replying to laurentj:

not the response type but the type asked by jTpl. I think we have a property for that on the object $tpl given to the function, I don't remember.

Apparently we cannot have access to the property "$outputType" since it's in the jTplCompiler and not in the jTpl object... If you have any idea on how retrieve this value...

is it still review+ ???

comment:14 Changed 11 years ago by laurentj

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

comment:15 Changed 11 years ago by mike

Thanks Laurent for this commit! I will update the next patches I have next week! Bye bye

comment:16 Changed 10 years ago by laurentj

  • Documentation needed set
Note: See TracTickets for help on using tickets.