developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.
#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)
Change History (18)
Changed 12 years ago by mike
comment:1 Changed 12 years ago by laurentj
- Milestone changed from Jelix 1.3 to Jelix 1.2
comment:2 Changed 12 years ago by mike
- review set to review?
comment:3 Changed 12 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 12 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: ↓ 6 Changed 12 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 12 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 12 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: ↓ 9 Changed 12 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 12 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: ↓ 11 ↓ 12 Changed 12 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 12 years ago by mike
I will check that and give another patch as soon as possible!
comment:12 in reply to: ↑ 10 ; follow-up: ↓ 13 Changed 12 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
Landed. http://hg.jelix.org/jelix/jelix-trunk/rev/ffcb29f0a823 thanks for this plugin.
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 11 years ago by laurentj
- Documentation needed set
comment:17 Changed 11 years ago by laurentj
- Documentation needed unset
the first patch, try it!