2

Is there a way in which to combine the Yii2 Advanced Framework with both a custom frontend (PHP/HTML) template as well as a second custom backend (PHP/HTML) template so that it truly resembles and behaves like these Pixelcave Templates? I have found a few answers (How Can I Customize Yii2 Theme and Yii2 Theme Integration describing how to apply just bootstrap and color changes through views and asset bundles but unfortunately little about how to convert Yii2's default settings for its navigation/linking/widgets to match the HTML structure I'd need. While there is much documentation on Yii2' framework site, many theme-related posts/blogs span back to 2011 (Yii1) and I fear I need more specific examples.

So, is there a way to make them compatible? If so, what steps do I need to take? If not, what PHP frameworks would be easier to manage this with? As an aside, the templates are built with Bootstrap 3.

Community
  • 1
  • 1
mijopabe
  • 646
  • 5
  • 23
  • Check out Twig templates and / or Symfony2 framework. – Tomasz Kowalczyk Nov 19 '14 at 00:23
  • @TomaszKowalczyk Symfony2 with [LiipThemeBundle] (https://github.com/liip/LiipThemeBundle) looks promising. I'm still hoping there's a solution/method for Yii2 but I'll look into this in the meantime. Thank you. – mijopabe Nov 19 '14 at 00:39

1 Answers1

2

Yes it is. It is quite easy to do to be honest and a bootstrap 3 template would fit quite well.

You can use the Yii default widgets most of the time as they are and just change the html class / properties or extend any of them.

I understand that you want to implement an admin template, this is what I did too but I regret doing it. I started to implement this one http://themeforest.net/item/its-brain-responsive-bootstrap-3-admin-template/909197?WT.oss_phrase=&WT.oss_rank=9&WT.z_author=Kopyov&WT.ac=search_list.

If you want to just use an admin template you can start with this one: https://github.com/mithun12000/adminUI that is decent enough. You can also look on how they implemented it. While I would do things a little different (I would extend the bootstrap widgets and change what I need instead of building them from scratch). It will not work from the start, you need to change the layouts/main.php to remove some things from there. Preview of the template is here: http://almsaeedstudio.com/AdminLTE/index.html

If you just need to apply some default attributes to all widgets of a specific class you can use this How do I set a default configuration for GridView in Yii2 without the widget factory? In yii1 the feature was called Widget Factory so you can google "yii2 widget factory" to get more results. If your theme is close enough to the normal bootstrap template you can do a lot with this. You can also change the template of some widgets like this to have control over what they render. Like this one http://www.yiiframework.com/doc-2.0/yii-bootstrap-activefield.html you can change the inputTemplate property to change how a row is rendered.

If you want total control you can always just extend the class.

Community
  • 1
  • 1
Mihai P.
  • 9,307
  • 3
  • 38
  • 49
  • Thank you for the answer. I'm not quite sure about the 'attitude' that you have assessed from my question, but I can assure you that none was intended and I apologize, just in case. As per the subject matter, I have read through the Yii2 docs and have been unsuccessful on my own. I would also like to create a post which details the process thoroughly once I am finished as other may find this useful. How would I extend widgets in Yii2 to make the framework resemble this template's structure: [http://pixelcave.com/proui] (admin template). Perhaps you could point me in the right direction. – mijopabe Nov 23 '14 at 17:37
  • Upon review, I found 'bloat wording' that can be removed which could be interpreted poorly. Long shot, but if one reader interpreted it that way, that others may also, meaning I ought to reword it. Hopefully it is better now. – mijopabe Nov 23 '14 at 18:45
  • Thank you very much for the detailed answer/directions. This helps me a great deal and I'll post a lengthier documentation of the steps towards my final results whenever I finish (most likely here) for others to find. – mijopabe Nov 24 '14 at 20:56