Re: autoLinkUrls in text helper
i did partly succeed
http://pastebin.com/NfmDC27L
the protocol is stripped and the length is shortened (if desired)
BUT it appends the additional option keys/values as attributes of the
link tag:
<a href="http://www.cot.ag/cuIb2Q/eruierieriu-erjekr" stripProtocol=0"
maxLength="12">
etc
Details:
Equal expectation fails at character 69 with [Text with a url <a
href="http://www.cot.ag/cuIb2Q/eruierieriu-erjekr">www.cot.ag/c...</a>
and more] and [Text with a url <a href="http://www.cot.ag/cuIb2Q/
eruierieriu-erjekr" maxLength="12">www.cot.ag/c...</a> and more] at [H:
\...\site\plugins\tools\tests\cases\helpers\text_ext.test.php line 44]
How can i remove them before the link is created but after i passed
them to the static prepareLinkName() function?
thx
On 7 Nov., 14:11, euromark <dereurom...@googlemail.com> wrote:
> hey guys
> currently the text helper autoLinkUrls() creates links with the same
> name as href:
>
> texthttp://www.url.demore text
> =>
> text < href="http://www.url.de">http://www.url.de</a> more text
>
> this gets really ugly if the urls are 100 to 200 chars long.
> how could i extend that method in order to achieve something like
> that:
>
> a) strip protocol (http://) from name (unnecessary - google does it in
> chrome as well) if "stripProtocol"=>true:
> text < href="http://www.url.de">www.url.de</a> more text
>
> b) shorten url if param "maxLength"=>x is passed (e.g. 15):
> text < href="http://www.url.de/somehundredschars">www.url.de/some...</
> a> more text
>
> this way it is way more readable and doesnt destroy the layout or take
> unncessary space.
> the current method seems to call $Html->link() inside
> "create_function". I dont know if that can be overridden...
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home