Give Me Cake

CakePHP Baking, Internet Marketing, SEO, Design and more

Image links with HtmlHelper

Posted on | October 8, 2008 | 1 Comment

To create an image link with Cakephp’s HtmlHelper, you need to pass in the $html->image into $html->link.

First step to use the HtmlHelper in Cakephp, you need to include the helper in the controller.
Using:

var $helpers = array('Html', 'Form');

In your views, (.ctp files), you will call with

<?php echo $html->link($html->image('rss_text.jpg',
array('class'=>'img-icon', 'title' => 'Subscribe to RSS')
),
array('controller' => 'features', 'action' => 'feed.rss'),
array('escape' => false, 'title' => 'Subscribe to RSS')
);
?>

Note that the second parameter for $html->link is an array instead of a string. This is to allow $html->url to handle the url and manipulate it. I recommend doing it this way to have more flexible and less headache when you need to change the pathing for your application.

You need to have escape == false in for the html attributes for $html->link to prevent the html returned from html->image being encoded. You can set the fifth parameter of $html->link to false instead. It will work too. Refer below for the function declaration.

References : Cakephp API

HtmlHelper::link  	(  	$   	 title,
$  	url = null,
$  	htmlAttributes = array(),
$  	confirmMessage = false,
$  	escapeTitle = true
)

HtmlHelper::image  	(  	$   	 path,
$  	options = array()
)

One important to remember when you are having campaigns to increase web traffic

Posted on | October 8, 2008 | No Comments

I am looking for a new web host. It so happened that I clicked on a link in my gmail webclips for a web hosting company in Malaysia. Geez.. I got a DNS not working.. Seems to me they are rockies in web hosting business. Will I remember the link to visit their website again? No. Will I click on that ad again? No, as long as I remember the DNS not working error.

So lesson learnt. Make sure your website is working and accessible thru out your campaign period.

CakePHP 1.2 RC3 released

Posted on | October 5, 2008 | No Comments

Woohoo! Performance improvements in RC3. Read about it here and the release notes too.

Look at that long list of task done. Great job CakePHP developers! Salute!

Auto Generated Text Images

Posted on | October 5, 2008 | No Comments

I find it cumbersome to create label image and upload it manually when updating categories or page titles from CMSes. In most cases, text label images are used instead of plain text mainly due to aesthetic considerations. Some advantages of using text label images:

  • text looks better with anti-alias
  • fancy fonts can be used for the menus or content

If the CMS can auto generate the label image, I no longer have to manually create images when updating the content

There are different approaches to achieve this. You can do it in Flash with a variable to pass in the text. You can do it with an image manipulation library and scripts. For this post, I will explain how to get it to work with Cakephp and GDLib.
Read more

New Look and Logo for Give Me Cake

Posted on | October 2, 2008 | No Comments

I have been hard at work customizing this template and creating logo for my blog.

Check this out!

Give Me Cake

Give Me Cake

  • Give me Cake?

    Givemecake.dev-work.com a collection of web application development tips, tutorials and resources.
  • See Your Ads Here

  • See Your Ads Here

  • Meta