static link in Zend Framework layout

Posted on 2009-02-13
Last Modified: 2013-11-10
How do I get a static link to my static file in Zend layout.phtml? I'm a newbie in Zend.

I mean that I have to create something like in the snippet. What do I put instead of "...."?
<img src='<?= $this->url (....) ?>' />

Open in new window

Question by:technoparkcorp
    LVL 49

    Accepted Solution


    You can use the front controller to get the base url for your application. Then you can append to your images quite easily.

    <img src="<?php echo Zend_Controller_Front::getInstance()->getBaseUrl();?>/images/test.gif" />

    Kind regards

    LVL 6

    Expert Comment

    you can just set it to the url if you like such as <img src='/images/icon.gif" />

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to dynamically set the form action using jQuery.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now