Jump to content
Larry Ullman's Book Forums

Ziggi

Members
  • Posts

    56
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Ziggi

  1. Dear Mr Edward, Please notice - I already know resources you've mentioned. Such general advisory is pointless. If I knew how to do the task based on this information I would not bother you with my questions. If you know the solution - please share. If not... Rgs, Ziggi
  2. Hi Larry, Actually, it was a little bit of frustration. Simply speaking - routing rules are confusing and available explanations not comprehensive. As I already bought your "Yii Book" a few days ago - I tried to find some info right there and... nope. Very little clues on the subject for the time being. My problem has started with hangling static pages in Yii. As you know, default site controller handle static pages through statically assigning "page" action to CViewAction class. This class render a view file residing in "site/page" folder and the name of the file is provided as query string: http://mydomain/index.php?r=site/page&view=FileName. Well - I am unable to find a good routing rule what would convert such an URL into something more SEO friendly like: http://mydomain/site/page/FileName. No way - nothing works! OK - there are some solutions descripted on Yii forums but they all require to manually specify routing rule for each and every static page on the website. This is nonsense. So, finally I found a workaround, but I am unsure is it an "elegant" one: Simply speaking, I consider static pages are pages what are actually served "as they are" - so no specific controller action is necessary to to serve them. Consequently - they can be served by the "missingAction" handler. So I have decided to create a new StaticController like this: class StaticController extends Controller { public function missingAction($actionID) { if(file_exists($this->getViewPath() . '/' . $actionID . '.php')){ $this->render($actionID); }else{ throw new CHttpException(404, 'Page not found!'); } } } And this controller can serve any view file residing in "/static" folder by its name. If given page is not found - proper exception is thrown. Consequently - there is no need to update anything while new static page is added. This is working nice but the only problem is... Menu item is not highlighted with given static page is displayed... Perhaps you can provide better solution? Best regards, Ziggi
  3. Hey Yii guys - please, explain your ideas precisely! For whatever reason Yii routing rules are not well covered. Can you explain exactly what the following rule if for: '<controller:\w+>/<id:\d+>'=>'/view' And can you explain this one: '<view:\w+>' => 'site/page' What is this going to do actually - step by step??? Can you provide some exhaustive list of possible markups? The routing rules explainations available are completely minimalistic - where are routing rules explained in a more comprehensive manner??? Can your help, please!
  4. Antonio, your remark: "CAssetManager is not intended for the purposes you describe here. The class is for handling site asset management, not for working with user assets." is of the critical importance and it is very refreshing indeed - thank you for saving me hours of pointless trials and errors! And thanks a lot for guiding me to this "How to upload a file using a model" wiki entry. It seems this is the right direction I go on. Thanks a lot! Ziggi
  5. Well, This is sort of strategic question. I am already familiar with Yii but now I am in course of developing custom mailing application for an add agency. They need to have strict separation of user files, so each mailing campaign's files are stored in a separated folder named after the campaign itself. The purpose is to ensure no file is confused even in case of a database failure. And I can understand this point. On the other hand, for whatever reason Yii defaults to keep all 'user asset' files in a randomly named folder and - surprisingly - the asset folder name is being changed with each Yii update. This is not nice in fact. The question is - what is a recommended strategy? How to organize WYSWIG editor, file manager, all file uploaders and finally - all the content so the above mentioned asset separation is properly implemented? Please help - the problem is becoming urgent! Thank's ahead, Ziggi
×
×
  • Create New...