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

  • SEARCH
  • Home
  • 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 8798645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:08:32+00:00 2026-06-14T00:08:32+00:00

What I want to do is convert the following to work with CakePHP: <a

  • 0

What I want to do is convert the following to work with CakePHP:

<a href="URL ADDRESS"><img src="URL OF THE FIRST IMAGE GOES HERE" onmouseover="this.src='URL OF THE SECOND IMAGE GOES HERE'" onmouseout="this.src='URL OF THE FIRST IMAGE GOES HERE'" /></a>

I have the following so far:

<?php echo $this->Html->image("animalhealth.png", array(
    "alt" => "Animal Health",
    "onmouseover" => "this.src='animalhealthhover.png'",
    "onmouseout" => "this.src='animalhealth.png'",
    'url' => array('controller' => 'records', 'action' => 'index'
    )
)); ?>

The problem are the onmouseover & onmouseout event lines. I need to tell cake to somehow use the helper method otherwise it just selects no image. I don’t want to have to put the entire address in as the is a navigation menu and there will be multiple instances of the app at different locations.

  • 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-06-14T00:08:33+00:00Added an answer on June 14, 2026 at 12:08 am

    I have managed to build a work around using CSS.

    Made a custom image for the button Icon.

    This is what goes in the view/layout page:

    <ul class="menu">
    <li>
                            <div id="button_name"><?php
                        echo $this->Html->image("name_of_img.png", array(
                            "alt" => "Animal Health",
                            'url' => array('controller' => 'controllerName', 'action' => 'index')));
                        ?>
    <?php echo $this->Html->link(__('Link Text'), array('controller' => 'controllerName', 'action' => 'index')); ?> 
                            </div>
                        </li> 
    </ul>
    

    If your not using cakePHP you could do it like this in a normal HTML page:

    <ul class="menu">
    <li>
                            <div id="button_name"><a href="/path/to/page.html"><img src="/path/to/img/imagename.png" alt="Animal Health" /></a><a href="/path/to/page.html">Animal Health</a> 
                            </div>
                        </li>
    <ul>
    

    This Makes both the text and the icon clickable.

    Then the CSS:

    .menu li {padding:0px; border: 0px; margin: 0px; list-style: none;
              float: left; margin-left: 0px; display: block; height: 36px;} //remove any stlying and set up for the menu.
    
    #button_name{background-color: darkorange;
                   float: left;
                  margin-right: 5px;
                   margin-top: 1px;
                   margin-bottom: 0px;
                   padding: 1px 3px 1px 3px;
                   -webkit-border-radius: 5px 5px 0px 0px;
                   border-radius: 5px 5px 0px 0px;
                   border: 1px black;
                   text-align: right;
                   color: #6495ED;
                   font-weight: bold;
                   -webkit-transition: all 1000ms;
                   -moz-transition: all 1000ms;
                   -o-transition: all 1000ms;
                   -ms-transition: all 1000ms;
                   transition: all 1000ms;}
    #button_name a {
        -webkit-transition: all 1000ms;
        -moz-transition: all 1000ms;
        -o-transition: all 1000ms;
        -ms-transition: all 1000ms;
        transition: all 1000ms;
        font-weight: bold;
        color: #6495ED; 
    }
        #button_name:hover
     {background-color: #6495ED;}
        #button_name:hover a // VERY IMPORTANT see note
    {
            font-weight: bold;
            color: darkorange;}
    

    This makes a nice button with 2 rounded top corners. When you hover over the button anywhere the background and text colours transition between each other. ie: text goes from blue to orange and background goes from orange to blue.

    Note about #button_name:hover a:
    You must set it as specified if you set it as “button_name a:hover” the text will stay the same color as the background.

    Hopefully this will help someone else.

    Still keen to hear any ideas about doing it with the JS.

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

Sidebar

Related Questions

i want to know how do we convert the following code to work with
I want to convert the following SQL Query to a SubSonic Query. SELECT [dbo].[tbl_Agency].[ParentCompanyID]
I have the following string: 2010-04-08T12:46:43+00:00 I want to convert that to: 8th April
I received DateTime String from Fedex in following format 2012-06-22T21:39:48-05:00 I want to convert
I want to convert the following json and put the values into a data
I want to directly convert a javascript object to string. I used following code.
The following code does not work due to line 4 (can't convert Foo into
I have the following: u'\x96' I want to convert it to the following: '\x96'
I want to convert the following code: ... urls = [many urls] links =
I want to convert the following code to ActionScript (mxml works fine): <mx:Panel title=Some

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.