Yii Framework Forum: Can't Get The Correct Url Path - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Can't Get The Correct Url Path Rate Topic: -----

#1 User is offline   corbeeresearch 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 21-August 10

Posted 20 January 2013 - 06:12 AM

Hi,

If my Yii app is located in this directory http://localhost/public_html/mywebapp/

how do I tell my code below that I wanted it to automatically be set under the dir above?


<?php
/**
 *  Extending CLinkPager so that we can give it a custom css file
 */

class LinkPager extends CLinkPager
{
        public $cssFile = '/css/pager.css';
}

0

#2 User is offline   seenivasan 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 620
  • Joined: 17-June 12
  • Location:Chennai,TamilNadu,India.

Posted 20 January 2013 - 06:55 AM

Dear Friend

If the following is the path of pager.css
http://localhost/public_html/mywebapp/css/pager.css


Then the following would work

public $cssFile = 'css/pager.css';



Regards.
0

#3 User is offline   KonApaz 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,325
  • Joined: 21-February 11
  • Location:Greece

Posted 20 January 2013 - 06:59 AM

Hi corbeeresearch

You could use also

public $cssFile = Yii::app()->baseUrl . '/css/pager.css';

Yii is the best php framework in the world!
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

#4 User is offline   corbeeresearch 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 21-August 10

Posted 20 January 2013 - 07:05 AM

View PostKonApaz, on 20 January 2013 - 06:59 AM, said:

Hi corbeeresearch

You could use also

public $cssFile = Yii::app()->baseUrl . '/css/pager.css';



I get this error

Parse error: syntax error, unexpected '(', expecting ',' or ';' in /var/www/public_html/tots/protected/components/LinkPager.php on line 8
0

#5 User is offline   corbeeresearch 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 21-August 10

Posted 20 January 2013 - 07:06 AM

View Postseenivasan, on 20 January 2013 - 06:55 AM, said:

Dear Friend

If the following is the path of pager.css
http://localhost/public_html/mywebapp/css/pager.css


Then the following would work

public $cssFile = 'css/pager.css';



Regards.



Unfortunately, I tried it, and didn't work.
0

#6 User is offline   seenivasan 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 620
  • Joined: 17-June 12
  • Location:Chennai,TamilNadu,India.

Posted 20 January 2013 - 07:10 AM

Sorry about that

Anywhere in my application, I can do the following to get contents of main.css in css folder.

$file="css/main.css";
echo file_get_contents($file);


Regards.
0

#7 User is offline   KonApaz 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,325
  • Joined: 21-February 11
  • Location:Greece

Posted 20 January 2013 - 07:24 AM

View Postcorbeeresearch, on 20 January 2013 - 07:05 AM, said:

I get this error

Parse error: syntax error, unexpected '(', expecting ',' or ';' in /var/www/public_html/tots/protected/components/LinkPager.php on line 8



Try this

public $cssFile;

 public function init()
    {
          $this->cssFile = Yii::app()->baseUrl . '/css/pager.css';
	  return parent::init();
    }

Yii is the best php framework in the world!
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
1

#8 User is offline   corbeeresearch 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 21-August 10

Posted 27 January 2013 - 07:14 AM

View PostKonApaz, on 20 January 2013 - 07:24 AM, said:

Try this

public $cssFile;

 public function init()
    {
          $this->cssFile = Yii::app()->baseUrl . '/css/pager.css';
	  return parent::init();
    }




Thanks, that does the trick!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users