TinyButStrong - the PHP Template Engine
Categories > TBS next version >

link keyword for htmlconv

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: tonier
Date: 2009-09-12
Time: 03:11

link keyword for htmlconv

Hi Skrol …

I want to talk about an automatic formatting that we used for create a valid link, as the added function that we used with htmlconv parameter.

Let us set this keyword with link, and the purpose of this, is to converting a string value to make a valid link.

I have got the idea from a link of a blog that created by wordpress.com, where it will contains the title of any blogs that referenced by the link.

The Example:

<a href=”[var.GlobalConfig.AppURL]read_blog/[blog.id]/[blog.title;htmlconv=link]”>[blog.title]</a>

If the title of it would be “How to Use TinyButStrong with PHP and MySQL”, then the result of above code would be:

<a href=”http://www.tinybutstrong.com/read_blog/123/How-to-Use-TinyButStrong-with-PHP-and-MySQL”>How To Use TinyButStrong with PHP and MySQL</a>

We can see how the title generated into valid link and easy to index by any popular search engines. This is useful for any web developer in the current competition, to gain more visits from the visitors that get the references from the search engines.
By: Skrol29
Date: 2009-09-14
Time: 14:36

Re: link keyword for htmlconv

Hi Tonier,

This is interesting.
But I can see a problem to implement this in native : while your conversion is smart for encoding titles to URL, it is not the usual way for encoding.
The most usual way is to use the PHP function urlencode()  :
  http://fr.php.net/manual/fr/function.urlencode.php
And there is also :
  http://fr.php.net/manual/fr/function.rawurlencode.php

If I would implement "htmlconv=url", it would be smarter to use urlencode() for it, but would it be useful for your case ?

By: tonier
Date: 2009-09-15
Time: 04:14

Re: link keyword for htmlconv

Hi Skrol, this is useful for our visitor to remember our link and it is easier for bookmarking or revisiting from the history address bar of any browser, since it is easier to remember if we read http://www.somesites.com/blog/1/how-to-use-php-mysql rather than any unusual characters like http://www.somesites.com/blog/1/how%20to%20use%20php%20mysql.

You are right Skrol, we already have urlencode() and I agree with that. However, for any serious web developer, they will do anything to make their visitors came back to visiting their websites again. That is why wordpress.com or any popular websites change their structures of link with something that easier to read and remembered by visitors.

By the way, I know if it is not a core function and the solution for such requirement only need a global variable and a small function to filtering the characters.


By: Skrol29
Date: 2009-09-17
Time: 13:14

Re: link keyword for htmlconv

Hello,

For your own case, you can use the parameter "onformat", wich can cll a user function to format the value.

Bu I thought that titles in the URL was made to improve the placement in Internet Search Engines. Who can remember an URL that is more than 20 characters?
By: tonier
Date: 2009-09-19
Time: 01:24

Re: link keyword for htmlconv

You're right Skrol , actually I can did it with "onformat" function :) ...

hei ... I did it with my history Bar :) ..

Great jobs Skrol, I hope 3.5 will ready for the next version ...