on the enhanced blog by mocapapa

To mocapapa and other developers:

Thank you for your enhanced blog. I am working to turn that into a real app in an enterprise environment. A few comments.

1, Is the current version for 1.0.3 only, right?

the following seems to be deprecated in 1.0.4.

change it to:

will work.

2, I am planning to add a "category" field in the post model. Have you done that already? If yes, I do not need to recreate the wheels.

Thanks again for the hardwork.

Thank you for having an interest of enhancing the blog demo, moho.

  1. I am using the latest version of the yii, i.e. version 1.1-dev-r956 in SVN, though I was not aware that my code was deprecated since the demo has been working so far (to me :) ).

  2. In terms of "category", as it is much like tag cloud, I have not ever developed such functionality. If you do, please open it to the public.

mocapapa,

I finally have time to revisit the code. The problem is still there. Basically the following code

$cs->registerCSSFile(Yii::app()->request->baseUrl.'/css/main.css', CClientScript::POS_HEAD);

does not do anything. I understand this is supposed to include a css file but I do not see it in the source code in my browser.

moho,

I got your point. First of all, I would like to delete the position parameter, because it may be useless. It means that the code piece in the 'protected/views/layouts/main.php' is as follows.

Quote

// css

  $cs->registerCSSFile(Yii::app()->request->baseUrl.'/js/highslide/highslide.css');

  $cs->registerCSSFile(Yii::app()->request->baseUrl.'/css/main.css');

Then, in terms of your point that there may be no main.css in the HTML source, there sure is.

I am using nice extension of extendedClientScript, that can compress js/css files. It means that you can see following lines in the HTML source, these css files such as highslide.css and main.css are merged into one css named c_76d5…3293.css.

Quote

<link rel="stylesheet" type="text/css" href="/demos/yii-blogdemo-enhanced/assets/8e71a30/c_76d5db76759a207cdd20a7ae59f03293.css" />

Hi, cool that you use extendedClientScript!

CHtml::cssFile() can be useful for snippets with extended CSS, but for normal use the registerCSSFile() is a better option indeed, especially when the CSS file is to be included every time.

Will check out the new R17 soon, and perhaps create some modules for it too. About the categories: that can be nice, since it will help converting it to a simple CMS instead of a blog.

@mocapapa: Was wondering: in the demo Blog some models were adjusted (Tag, Post). Also some _form views. How closely do you follow the changes in the demo blog? Strict or will you follow a more independent approach?

Quote

Hi, cool that you use extendedClientScript!

Thank you for your nice extension  :)

Quote

@mocapapa: Was wondering: in the demo Blog some models were adjusted (Tag, Post). Also some _form views. How closely do you follow the changes in the demo blog? Strict or will you follow a more independent approach?

I am not sure what you mean, but you are wondering that I am following the changes of the original blog demo or not, right? Actually, I check the blog demo some time but do not recognise the need for changing my extension. I think there only was a minor change in terms of the algorithm so far.

mocapapa, thank you very much for your explanation. That explained a lot.  :) I now know the logic. Should have spent more time on the doc.

I now where the problem is. For the combined the files, I see the following file structure.

/assets/251b079cc_da5868dbc61a4785c2acb32f38265226.css

Notice the forward slash after 251b079c?I think it is a bug under Windows box. I will try it under my apple machine to see if it is a Windows-only bug.

Thank you again.

Update: I looked at the extendedClientScript.php and found the author is using:

DIRECTORY_SEPARATOR”.

I changed it to '/' and everything works like a charm. I think we do not need to use that constant according to

http://old.alanhogan…r-not-necessary

About our little friend 'DIRECTORY_SEPARATOR': I normally don't use it in my work, but since Yii is full with DIRECTORY_SEPARATOR, I thought it would help to stay compatible in other environments.

I will skip it in a new version. It's kinda strange it's not giving you trouble on other places.

@mocapapa: okay, cool.

Maxximus, I also notice this little friend is everywhere in the framework. Not sure why it gives me problems in this extension only. ???

Anyway, I am a happy man now. :)

Even I myself have used this little friend without a full knowledge, but it seems to be used as follows.

File location: DIRECTORY_SEPARATOR

URL:          '/'

Here's a little clarification on DIRECTORY_SEPARATOR as i know it.

DIRECTORY_SEPARATOR is supposed to provide the correct slash ("/" for *nix or "&quot; for Windows) for the file system for the OS on your box. When you are accessing something via HTTP, the slash should always be "/".

So in simpler terms, always use DIRECTORY_SEPARATOR only when you are concatenating a file-system path, but never use it when you are referencing a HTTP path - these are ALWAYS "/".

Hope that helped  ;D

Yes, that’s what I have learned very recently, thank you. :)

I have been trying to make this work as a module but am not having any luck yet.

Wow! I could not convert this enhance blog to module. I keep getting 404 and have no clue. Matter of fact even my Default module created using Yicc tools gives me 404. Any help - thanks.

Quote

Matter of fact even my Default module created using Yicc tools gives me 404. Any help - thanks.

Sorry but I cannot help because it is not related to the blog demo, but to the usage of the module, and I do not have the experience of using modules.