Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6215579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:04:59+00:00 2026-05-24T07:04:59+00:00

echo $this->Html->link( ‘more’, array( ‘controller’=>’posts’, ‘action’=>’view’, $post[‘Post’][‘id’] ) ); How can I assign an

  • 0
echo $this->Html->link(
    'more',
    array(
        'controller'=>'posts',
        'action'=>'view',
        $post['Post']['id']
    ) 
);

How can I assign an id and class for this anchor/link? I want to override its css rule.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:05:00+00:00Added an answer on May 24, 2026 at 7:05 am

    HTML attributes can be specified in an array as the third parameter.

    echo $this->Html->link(
        'more',
        array(
            'controller'=>'posts',
            'action'=>'view',
            $post['Post']['id']
        ),
        array(
            'id' => 'myId',
            'class' => 'myClass'
        )
    );
    

    More info in the Cookbook 2.x for the 2.x version or Cookbook 1.3 for CakePHP 1.3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following link: <?php echo $this->Html->link($post['Portfolio']['title'], array('controller' => 'portfolio', 'action' => 'view',
I have the following link structure for my portfolio: <?php echo $this->Html->link($post['Portfolio']['title'], array('controller' =>
Why this: echo $this->Html->link('Add a User', array('controller'=>'users', 'action'=>'add')); Instead of just this: echo $this->Html->link('Add
This is one => echo $this->Html->link('Edit', array('controller'=>'comments','action'=>'edit',$comment['Comment']['id'])); This is another one in form =>
I generate in Cakephp with Html->link a link echo $this->Html->link('Download',array( 'plugin'=> 'galleries', 'controller'=> 'galleries',
Often when writing PHP I'll have it output some HTML like this - echo
I have this PHP code echo '<a href=# onclick=updateByQuery(\'Layer3\', ' . json_encode($query) . ');>Link
echo date(W,strtotime('2010-01-01')); This outputs 53. I would expect it to output 1. Can anyone
I'm curious why this won't echo the HTML; I've perused the other questions in
can this code snippet be modified to reveal html coding? <?php $_option = $this->getOption()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.