always use html->link

June 20, 2006 at 1:27 pm Leave a comment

Always use $html->link when creating links. This html helper appends your base path to the beginning. This is helpful when your settings is in a subfolder.

Example, your webroot is in ‘https://cakensoda.wordpress.com/cake’. Without using the html link helper, your links will only be ‘/controller/action’ instead of ‘/cake/controller/action’

I learned this in a not-so-friendly way bec i used the a link tag before to form my links. But when my webroot was moved to a subfolder, every link didnt work!

Also, if you cannot use $html->link due to some special reasons, I use the $html->base to append my base path.

Advertisements

Entry filed under: baking tips, cakephp.

I love Cake! saving in a loop

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent Posts

June 2006
M T W T F S S
    Jul »
 1234
567891011
12131415161718
19202122232425
2627282930  

%d bloggers like this: