CodeIgniter Forums
html helper and CSS - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: html helper and CSS (/thread-25306.html)



html helper and CSS - El Forum - 12-07-2009

[eluser]Krystian[/eluser]
I`m using html helper

Code:
<?php echo img("img/pic1.jpg") ?>

and I want to add a css class. How to achieve that?

I don`t want to use

Code:
$image_properties = array(
          'src' => 'images/picture.jpg',
          'alt' => 'Me, demonstrating how to eat 4 slices of pizza at one time',
          'class' => 'post_images',
          'width' => '200',
          'height' => '200',
          'title' => 'That was quite a night',
          'rel' => 'lightbox',
);

img($image_properties);

is there any trick to add something to my code??

cheers


html helper and CSS - El Forum - 12-07-2009

[eluser]markup2go[/eluser]
[quote author="john_doe" date="1260240266"]I`m using html helper

Code:
<?php echo img("img/pic1.jpg") ?>

and I want to add a css class. How to achieve that?

I don`t want to use

Code:
$image_properties = array(
          'src' => 'images/picture.jpg',
          'alt' => 'Me, demonstrating how to eat 4 slices of pizza at one time',
          'class' => 'post_images',
          'width' => '200',
          'height' => '200',
          'title' => 'That was quite a night',
          'rel' => 'lightbox',
);

img($image_properties);

is there any trick to add something to my code??

cheers[/quote]

Might be easier to just pass it the associative array directly like:
Code:
img( array('src'=>'img/pic1.jpg', 'class'=>'someClass') );

Can't get much easier than that Wink


html helper and CSS - El Forum - 12-07-2009

[eluser]Krystian[/eluser]
thanks a lot markup2go, that`s was the begining. Can you look at this please?

I got two tables

categories(id, name)
products(id, photo, id_category)



I would like to print on the screen something like this


categoryName1 photoProduct1 photoProduct2 photoProduct3
categoryName2 photoProduct1 photoProduct2 photoProduct3
categoryName3 photoProduct1 photoProduct2 photoProduct3
.
.
.
and so on until categories end
photo from products can be print e.g top 2

I don`t know how to print it in such way....


cheers