Sunday, July 4, 2010

Re: css + php layout: what do i need to do, to change this "usual php code" into cakephp terms?

On Sun, Jul 4, 2010 at 10:56 AM, Tomfox Wiranata
<tomfox.wiranata@gmail.com> wrote:
> hi,
>
> i created a layout for my user profile before i used cake. so its made
> in usual php with plain css and divs. now i'm confused how to transfer
> it into cakephp specific terms. although, if i copy the code into my
> view it gets rendered correct. but i want a clear structure and not
> mixing it. if i use cake, i want my website coded in cakephp
> principles :)
>
> here are the fragments:
>
> first usual DIVs and links:
>
>                <div class="picturebox">
>                        <div class="linkbox">
>                        <a href='index.php?site=editprofile' class='links'>Profil
> bearbeiten </a>
>                        <a href='index.php?site=profile' class='links'>Nachricht schreiben
> </a>
>                        <a href="index.php?site=profile" class="links">Profil melden </a>
>                        <a href="index.php?site=profile" class="links">Eigene Linkables </
> a>
>                </div>
>        </div>
>
> what code do i use in cake to implement links to other sites without
> loosing the css formatting? can i re-use some of this code (my DIVs)
> or do even those need to be re-coded?

Use the 3rd param to the Html::link() method to pass HTML element attributes.

echo $html->link(
'Profil bearbeiten',
array('controller' => '', 'action' => ''),
array('class' => 'links')
);

It's difficult to say what the controller/action names should be here
based on your earlier, non-Cake code. It appears that the last 3 of
those links point to the same place.

Also, you could probably do without the class="links" altogether,
since your CSS rule could be:

.linkbox a { ... }

There's no reason for the divs to be re-coded.

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

No comments: