[PLANNING] Yii CMS - a different approach

I am fairly new to Git and haven’t tested the sub-repo feature yet, but that’s definitely on my list.

But what’s the difference between a fork and a branch in Git? I thought everything is a branch … or a fork - isn’t it the same?

Would be glad, if you could set up an example Yii application with sub-repos.

I could not get cmssitestructuremodule working, simply too many PHP errors, or maybe it isn’t compatible with Yii 1.1.8-dev.

Last error:


CException TreeBehavior does not have a method named "getIsNewRecord".

Would be great if you can create a GitHub branch with a working cms module ;)

If the module renders content as text or html it’s not possible to add a widget.

You’d have to extend it, so it could can also render or execute PHP, but that as also security implications.

But p3widget would be able to handle it’s widgets, because it can vary its content by module-ID and request-Param, which should be sufficient - but module-ID handling is not implemented … yet.

Branches are local to the repo. I don’t know about Git specifically, but in Mercurial, repo branches aren’t as fun/easy as a fork is, and I know in Mercurial that users are heavily encouraged to use forks as everything seems to run more smoothly than the branching process. I’ve tried branches before and didn’t enjoy the workflow. After that initial attempt at branching (and subsequently finding that forking is more common), I personally have yet to find a need for a “branch”.

Forks are a way for anyone (yourself or any "follower") to create a new repo based on whatever is being forked from. You can (manually) pull in changes from the parent repo whenever you desire, which includes committer & history information (after a pull, you would merge the changes into your fork, and then commit/push the merge).

Within Github (or Bitbucket, if using mercurial), you can then see the heritage of a repository, to see what forks have occurred (full parent/child genealogy).

In my own projects, I use a structure like so:

“Yii Base” (mercurial mirror of Yii SVN repo’s /framework/ directory contents)

“Yii Application” (default Yii-generated app with some small customizations, so that I don’t have to generate every time. Also contains “Yii Base” as sub-repo in /framework/ dir)

-> "Some Project" (I create a new fork of "Yii Application" for whatever project I happen to be working on)

I use forks and sub-repos to keep changes a bit more segregated, so I can more easily maintain code bases separately. If I create an extension (such as my new Riiak ext), it gets it’s own repository, which I have now pulled into “Yii Application” as a /protected/extensions/riiak/ sub-repo. Then all of my projects (which are forked from “Yii Application” can just pull in the latest changes from their parent repo to have the new Riiak sub-repo show up.

Hopefully that post is coherent, I’ve had a long day.

If you have any questions or don’t quite understand what I’ve said above, just msg me, I’ll show you exactly what I’m talking about.

Cheers

Hi intel352,

thanks for clarification.

I do not know Mercurial at all, but in Git branches are very cheap.

As mentioned I still have to learn Git but I’ll include the things you mentioned in my plans.

Best regards,

schmunk

btw: Here’s the discussion about the p3widgets module.

in cms project or other project , the searching functionality is required ,so how to develop it, my thought is to create a search module , when people search something there is a center place for searching , like :search people(may have some subitem to helping search ,etc age,area ,gender …),search blog, search picture,search video ,search audio …

for well structure and flexible of system, and there may have some unknown modules will be added in future,the search module should modify little or even no modify .how to achieve this goal?

another question : how to design a system that composed of many modules , and these modules should communicate to other modules , often the module should be separate from other modules but inevitably there comes some relation which need to connect these modules, like the search module ,adminModule etc…

. so some communication mechanism is needed . and the relations between modules will be as class : admin,extend , dependent ,use , aggregation …

Best regards !

About the search function … I think you’re totally right with your posting.

I also thought about this many times, but I haven’t found a perfect solution.

In Phundament 2 for example every core module provides a search function by a CAutoComplete input field. But that’s far from perfect.

But I think this should be accomplished by the module. It has to provide a custom view for selecting records. Facebook does this pretty nice IMHO, sometimes they have kind of autocomplete input and more complex stuff is handled by a custom view in a HTML dialog.

For displaying results I think the search-condition feature comes in pretty handy.

http://www.yiiframework.com/doc/api/1.1/CDbCriteria#addSearchCondition-detail

But in the end most likely you’ll write your own custom search, also because of the actions the user will take after searching. For example images … do you want to display the image or the complete page where the image is found.

When using the widget system it gets even more complex with searching, because you’ll first have to find the content data in your database and then also the position of the container, which renders the widget with this data.

So, very often I end up with a Google search for our sites.

Also an option would be Lucene, but I haven’t tried it yet.

Let us know if you have more thoughts about this topic, I would definitely put this on the conventions list.

Oh … PS to all:

What’s about Yii Modules Conventions Association (YMCA) as a working title for this? ;D

Just a little note … Moving extensions and modules into git-submodules

Example here:

https://github.com/schmunk42/phundament/tree/master/protected/extensions

If you want to clone the repo now, you should do it with the recursive option


git clone --recursive git@github.com:schmunk42/phundament.git

I love using sub-repos, glad you are doing the same as well.

It’s definitely improved my development process (using Mercurial)

Cheers

[Update] Submodule transition now complete…

https://github.com/schmunk42/phundament/tree/master/protected/modules

https://github.com/schmunk42/phundament/tree/master/protected/extensions


[submodule "protected/extensions/gtc"]

	path = protected/extensions/gtc

	url = git@github.com:schmunk42/gii-template-collection.git

[submodule "protected/extensions/yiiext"]

	path = protected/extensions/yiiext

	url = git@github.com:schmunk42/yiiext.git

[submodule "protected/modules/p3admin"]

	path = protected/modules/p3admin

	url = git@github.com:schmunk42/p3admin.git

[submodule "protected/modules/p3widgets"]

	path = protected/modules/p3widgets

	url = git@github.com:schmunk42/p3widgets.git

[submodule "protected/modules/rights"]

	path = protected/modules/rights

	url = git@github.com:schmunk42/yii-rights.git

[submodule "protected/modules/user"]

	path = protected/modules/user

	url = git@github.com:schmunk42/yii-user.git



Schmunk your idea is excellent, I also saw the video and I was impressed.

I tested phundament2 and I like the fact that it shows many thinks in dropdown lists or hidden divs. This is something that must be followed in every CMS.

In phundament2 I was confused in the structure of inputs for HTML, pages etc so I believe we must have something like an info icon beside each title and onmouseover show a dialog.

Someone said that frontend and backend must be totally different. I partially disagree and my opinion is that the person who writes articles, titles of sections etc must see the frontend somehow but full of icons for inline/modal edit, send to trash, add new etc.

In addition, I believe that similar to Macs/GNOME 3/Unity/Windows 7 a search must be on the top toolbar and show every widget/article title/category title etc when we type letters. I thought that p2 had it in inputs of HTML etc but even I typed some letters nothing appeared.

Did you think of using Smarty ? I believe that it will be very helpful for many developers.

I suppose that some of the above are already in p3 but up until now I couldn’t test it.

Hi petros,

sorry for my late respone, I went into holidays at the day you were posting this.

In Phundament 3 there’s no HTML widget anymore, you could create one if you want to but HTML content is now built-in native into P3Widget, which offers a very slim approach on how to dynamically create widgets with almost any options you want.

I’ve just finished the first version - but yet to be released - of P3Media which is a FileManger with ckeditor integration. This is another core part of my idea of a Yii-based CMS.

I think you could create any page dynamically with P3Widget and P3Media together.

Following the main idea, the UI should also be minimalistic.

I would like to have an input control, which just displays values and a button, together with a jQuery dialog, where you can render your custom select view. Facebook does this very well I think.

I agree with almost all points, but I don’t think we need smarty. PHP itself is the most powerful template engine in PHP ;)

If you want to restrict access to certain functions to the user, there may be a more "Yii-style" way to do this…

Best regards,

schmunk

Please have a look at the superfresh installation instructions for the complete package:

https://github.com/schmunk42/phundament

For the impatient :)


git clone --recursive https://github.com/schmunk42/phundament.git phundament

edit phundament/protected/config/main.php

./phundament/protected/setup-p3.sh "/path/to/existing/yiic/command"

Including p3media, a file manager with ckeditor integration and the latest fullCrud templates from gtc.

Looking forward to your feedback.

[size="4"]Phundament 3 now available via Yii Extensions[/size]

schmunk, this is awesome. Regarding the frontend/backend distinction, coming from Joomla, I know that many people there report the frontend/backend split as a huge training issue. Drupal, notably, has a single interface, as does Concrete5. Agreeing with the last poster, I like, as much as possible, a single interface with slight variations depending upon the roles of the logged in user.

Hi kenlyle,

thanks for your kind words :D

The interface depending on roles should be available since to latest release, I’ve added an ‘Editor’ role via rights with permissions to the controllers of p3media and p3widget. If you’re not an ‘Editor’ or ‘Admin’ you can’t edit widget or upload/edit media files.

Will also think about the search petros mentioned.

Best regards,

schmunk

Hi Tobias

I’m really getting into your stuff , but I’m facing some small issues blocking my full grasp of your work :(

maybe you could give me your thoughts or shed some light

Is the project still active ?


I managed myself but it would be usefull for those who can’t run scripts to have a data folder for any widgets migration

so people could do it the old way as well using an sql dump


is there a way to manage Localisation ?

answer : check lkatest release



has anyone experienced any issues with removing index.php ?

I’m having issues when keeping ‘showScriptName’ => false ?

any idea ?

I have many site working with my apache set up and , they work fine with and wihtout the index.php

but I’m having problems with getting all the headers urls to run with phundament 3

it all works when I desactivate index.php

quite frustrating because then this breaks all the media stuff

answer : The .htaccess files laying around the phundament structure removing them solves the issue