PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 16, 2022

[FIXED] Yii::app()->baseUrl is not working

 February 16, 2022     php, yii     No comments   

Issue

Why

<a id="tray-button"><img id="tray-arrow" src="http://localhost/ric/slideshow/img/button-tray-up.png"/></a>

is working but not this

<a id="tray-button"><img id="tray-arrow" src=<?php Yii::app()->baseUrl.'/slideshow/img/button-tray-up.png'?>/></a>

Provided http://localhost/ric -> is my webroot.

Here is the basepath configuration from my main.php

'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

Solution

You need to "echo" the baseUrl

<a id="tray-button">
  <img id="tray-arrow" src="<?php echo Yii::app()->baseUrl; ?>/slideshow/img/button-tray-up.png" />
</a>


Answered By - Asgaroth
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing