generate links from backend to frontend

Sorry for my English

The site I built the structure described here

Everything works fine and I am pleased by the separation. But there was one problem. Needed to create a link from the admin on the client side. The problem in the first place is that urlManager inserts a link instead of the required admin.php index.php. Second transformation rules are in url to the config file frontend.

I implemented it this way.

class FrontendUrlManager extends CUrlManager {

    private $_baseUrl;

    public function __construct() {




        foreach($config as $key=>$value)



        public function getBaseUrl()



                        return $this->_baseUrl;







                        return $this->_baseUrl;




Using now so


Solution until the suit but decided to show it here. Perhaps there is a much better option.

You current implementation is fine :)

How is supposed is the implementation?

I created that as component and saved in /protected/components/FrontendUrlMananger.php

Then, in main/config.php:




If I write Yii::app()->frontendUrlManager->createUrl(‘site/index’) I get: Property “CWebApplication”.“frontendUrlManager” is not defined

What’s wrong?

I only needed to set this in config/back.php: