<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<sect3 id="zend.view.helpers.initial.baseurl">
    <title>BaseUrl Helper</title>

    <para>
        While most <acronym>URL</acronym>s generated by the framework have the base
        <acronym>URL</acronym> prepended automatically, developers will need to prepend the
        base <acronym>URL</acronym> to their own <acronym>URL</acronym>s in order for paths
        to resources to be correct.
    </para>

    <para>
        Usage of the BaseUrl helper is very straightforward:
    </para>

    <programlisting language="php"><![CDATA[
/*
 * The following assume that the base URL of the page/application is "/mypage".
 */

/*
 * Prints:
 * <base href="/mypage/" />
 */
<base href="<?php echo $this->baseUrl(); ?>" />

/*
 * Prints:
 * <link rel="stylesheet" type="text/css" href="/mypage/css/base.css" />
 */
<link rel="stylesheet" type="text/css"
     href="<?php echo $this->baseUrl('css/base.css'); ?>" />
]]></programlisting>

    <note>
        <para>
            For simplicity's sake, we strip out the entry <acronym>PHP</acronym> file (e.g.,
            "<filename>index.php</filename>") from the base <acronym>URL</acronym> that was
            contained in <classname>Zend_Controller</classname>. However, in some situations
            this may cause a problem. If one occurs, use
            <methodname>$this->getHelper('BaseUrl')->setBaseUrl()</methodname> to set your
            own BaseUrl.
        </para>
    </note>
</sect3>
