how to change the default theme of Yii application with my own theme?


(Arsh302) #1

I am new for this Yii framework , and working on a project which is just same to www.foodpanda.com. I also purchased the Yii application of the same multiple-restaurant.codemywebapps.com/.

my question is that, how to change the default theme of this project with my own designed theme or layout ??

Please help me to rid out of this problem …


(Jawwad Software) #2

Hey, Its simple.

Just create a folder name themes on the root of application, inside it create a folder with your theme name and copy the /views in it.

Now you can change the main.php of your theme folder and column1 and column2.php files in the layouts folder.

Last is to update your theme in the config/main.php

you may also have look to the following http://www.yiiframework.com/doc/guide/1.1/en/topics.theming

must read is recommended


(tamaphp) #3

In your root directory, create a folder themes/your_theme_name

Inside your themes folder is where all your views should go,


/protected

/themes 

  /your_theme_name

      /views

         /layouts

           /main.php

         /yourController

           /yourControllerView.php



In your config/main.php, add


 'theme'=>'your_theme_name',


(Arsh302) #4

Thanks to response …

But again i have a doubt, the application which i have purchased has own css and js,etc.

my question is that, how to apply all the functionality of my application on my theme(which i added manually) ?


(Arsh302) #5

can anybody help me out, how to link the social media icon ?


(Arsh302) #6

Hello everyone…

Thanks to all for response.

Now I have again a problem, can I use two different top header(Navigation), in a single layout?

means, at my home page, there is only one menu item which is Login, and after successful login, my navition will be converted into a multiple items, like, about, offers, get in touch, etc…

how to resolve this problem?

Please do reply


(Anamikasri Mca) #7

Hello,

Its quite easy.

You can check status of user in layout file using "Yii::app()->user->isGuest" function . If its return true then include header file with single navigation and in else part you can include other file.

Thanks


(Arsh302) #8

Thanks Anamika…


(Arsh302) #9

Thanks Anamika, I have solved that problem…

thanks a lot…

I have one more problem, could you help me ?

I purchased an Yii application, which is running on local host well, but when I am uploading this application on server, only home page(first page) is working, rest of the links, login popup, etc are not working. Page not founds error is displaying…

please tell me how to solve this problem.


(Anamikasri Mca) #10

Hello arshad,

Its really good, that your problem is solved.:) I hope rewrite mode is off on your server, please check.

Thanks

Anamika


(Arsh302) #11

hello Anamika …

The server on which I am uploading the my Yii application, is my company’s server like http://www.mycompany dpmain.com/Project/my_yii_app.

but on the same server i have uploaded so many web applications.

so please tell me how to resolve this problem.

thanks for reply …


(Anamikasri Mca) #12

Hello,

Have you setup any Yii application before on this server?

If no please setup a demo Yii application and test with that, that’s links are working or not.

Thanks


(Anamikasri Mca) #13

Hello,

Please create a .htaccess file on root path and place this code there.

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

otherwise forward it to index.php

RewriteRule . index.php

Then check

Thanks


(nayan.thakkar) #14

It’s an Url issue first check your urls and change them as per your server requirement and than create a file in your project root as .htaccess with following content.

RewriteEngine on

If a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

Otherwise forward it to index.php

RewriteRule . index.php