The CMS Object topic (W.I.P on the name)

NuvoNuvo Forum LeaderVPS - Virtual Prince of the Server
Hello.
So this forum is pretty "daed" as n00bs would say, but I'm not one of those, so dead it is :]
Anyway, it probably should be somewhat down to me to actually post here as I'm pretty much the only one tinkering away with Rails as everyone else here uses PHP or, heaven forbid, ASP.

Anyway, I've been doing a small project on and off for a while, just to see how it would go.
Based on the 15 minute blog webcast on the Rails site, a bit of reading and some experimentation, I've tried to build a very small (in terms of features) CMS like application that's capable of running a blog, but which extends beyond the scope of something like Blogger.

CMS Object (name sneakily stolen from Python, who happened to be the owner of cmsobject.com, but he wasn't using it) is the result, or it will be when it's finished.

What the **** did you build another blogging script for?
Because 99.995% of them are done in PHP these days, so using Rails gave me an excuse to try building something on this scale as opposed to smaller PHP apps that were only designed for my personal sites (and were rebuilt to fit the needs of each individual site rather than being one flexible app package).

Is this a Nuke \ Textpattern \ Movabletype \ Jesus clone?
No, not really.
True, it allows you to make sites such as blogs or sites with a news section, but I've put my own twists on things as well.
It's not inspired by anything else, though I'm trying to make it as anti-Nuke as possible as PHP-Nuke is a horrible CMS, or it was when I last had to use it anyway.

A news \ blog system you build into a site, or an actual CMS?
It's not just a news or blogging system, it offers other features such as extra content pages and theme management.
On the other hand, it's not completely bolted down, meaning it's possible to build sites which may have the basic feature set provided by the system, but which don't work as if you'd just thrown a skin on to it.
Since theme templates use Rails code, you can do anything Rails can in them, meaning that if you want to do something not in the engine and you can figure out how, you can do it.

Rails code in templates, that could be a problem!
Agreed, if someone built a malicious theme package with destructive code in it, they could seriously damage a site, but this hasn't hurt systems like Typo yet, and if this does become an issue, there's always the chance of changing to something like Liquid (like Smarty for Rails) later on, meaning things can be locked down to a pre-defined set of non-Ruby tags.

What kind of crazy moon language does this thing use for formatting?
Actually, blog posts use Markdown, which is a pretty neat little system that does the same as BBCode, only with less... er... code.
The only weird thing about Markdown is that to start a new line, you have to hit space twice and then return.
The logic of this is that you may not want the entry to actually render with new lines after Markdown has gone over it (just doing it for readability, or because you're an oddball), so you have to basically tell it to insert them.
Textile and XHTML \ text modes are supported for the other sections editable in the admin control panel, meaning you can write some proper code for extra pages, though Markdown is probably the better option.
When using XHTML \ plain text, you CANNOT use RoR tags as these won't be parsed (because the page data is actually stored in a database and loaded as needed) though JavaScript and other non-server-side stuff should be fine.

On top of this, when writing a new post, quote marks will magically change to pretty, curly quotes (thanks to a clone of Smartypants) and source code highlighting is possible for Ruby, RHTML, HTML, Delphi and some other languages by using the following code:
[html]<code lang="html"><div class="dis">This is in a div</div></code>[/html]
But when shown, you get highlighted code with line numbers.

No visual editor?
No, you get an editor similar to those on forums where it's plain text and tags with rows of formatting buttons and such.
WYSIWYG editors aren't brilliant at doing valid XHTML, HTML 4.01 or anything valid for that matter, no matter what browser you're using (because it's the browser that's building the code, which is why these things only work in browsers with designmode support).
They also dislike some things which are used to allow for extra post formatting, don't use Markdown (not actually a problem if it's writing HTML for you) and don't always play nice with children under 22 years of age.

"extra pages"... the what now?
CMS Object allows you to build extra pages into your site such as an about page from within the admin control panel.
This is designed more for static pages, but JavaScript should work and I might try adding some form of extra tagging system in the future like Textpattern has.
Basically, you type in the page content using Textile, XHTML or Markdown, provide a few other details (the name for the URL for the page such as "a_picture" and the name to use in linking to that page such as "a picture of me"), tell the engine if you want it to show up on the main nav menu and you've got an extra page.
The page contents are saved to a database and are loaded into the site template, meaning no extra files are created.

I hate AJAX... There better not be any AJAX or I'm going to punch you on the nose!
That's why I've already had a restraining order sorted out my friend!
In all seriousness, I hate sites which misuse AJAX myself, so I don't want to end up building something that is itself crippled by it.
Yes, there's AJAX in the CMS, but it shouldn't stop you using it.
Things like inline previewing mean less reloading or navigating to other pages (meaning no loss of whatever you happened to be doing).
Nothing I've done will do horrible things like nuking the back button or weirding out whatever settings have been changed as I don't use AJAX to take over tasks which should be left to normal server-side scripting methods.

Is theme building hard?
Not really, no.
If you're not actually wanting to change things like how individual posts are shown, you can pretty much ignore the Ruby in the template files.
Rather than being a system where you have a top half of a template and a bottom half, templates are just normal HTML files (though they use the .rhtml extension) which have a few small tags like <%= yield %> in them (that one just tells Rails where the main body of page content should be placed).
The template directory structure looks like this:
<main directory you installed to>
-themes
--<theme>
---layouts
----blog.rhtml
---views
----<various views>
---images
---javascripts
---stylesheets

You can access images, stylesheets or javascript files that are in a theme by using URL's such as /theme/images/image.png.
The /theme/ URL path calls an internal block of code which sends the file you request to the browser without it needing to actually be in a public directory and it doesn't give away the real location.
The main thing to change when building a new theme is the layouts.
The file "blog.rhtml" is what your site looks like everywhere other than in stuff like RSS feeds.
Views don't need to be changed, and leaving them out of a theme completely will make the engine revert to the stock code found in /app/views/.
Views are the files which are rendered into the main template when an action is carried out, so navigating to site.com/show/12 will load the data for the 12th blog entry into the "show.rhtml" view file, which is rendered in the main template (blog.rhtml) in place of the <%= yield %> tag.

When is it going to be out? When can I play with it?
NEVER!!!
Or whenever it's done :]

If you took the time to write this long, long post, you could at least post images!
Linked to at the bottom of this post :]

Post manager:
Showing the interface for managing posts.
Inline previewing can be seen in action (this can be toggled on and off on a per-entry basis).
In the image, you can also see the results of Markdown formatting, Rubypants quote beautifying and code highlighting.

Post list:
Showing a list of currently published posts on the publicly viewable site (though obviously not public since it's running on my personal server and yes, I am sad enough to post meaningful posts to it).
Note that post dates can be shown as either dates, or as the amount of time that's passed since the post was created by changing a small bit of code in one of the views.
Also, you might notice that some links in the nav menu look different.
This is because when you're on a page, you don't really need to link to it from itself, so the links will only be links if you're not there, otherwise they display as plain text, which is handy.
That also goes for the linking of post titles.

Page view:
Just shows some rather basic gibbering I typed in for an about page.
The reason for there being two about links is that one is created by the page management system and one is just a bit of text loaded and formatted outside of the page manager (this will be removed at some point, but I'm so very lazy).

P.S.
Cex is not an adult site, it's just the... er... "catchy" URL for the Computer EXchange chain of PC and console trading shops over here (they suck, but their online trade in calculator helps get one over on those "we'll beat any offer" toting shops).
PHP, CSS, XHTML, Delphi, Ruby on Rails & more.
Current project: CMS Object.
Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
Release date: NEVER!!!

Comments

  • DeluxeNamesDeluxeNames Admin Administrator
    Thanks for your post Nuvo! You've single handedly brought the ROR forum back to life :)
  • danielneridanielneri WP V.I.P. VPS - Virtual Prince of the Server
    Looking good!

    I'm looking forward to the release, if there ever is one :D
    ban1.gif
  • NuvoNuvo Forum Leader VPS - Virtual Prince of the Server
    Hello again.

    Changes in my time out :[ :

    Theme installer built:
    Themes are now easier to use as there's a sort of installer now.
    You still have to upload the unpacked theme to the themes directory, but then, from the admin interface, you just type in the name of the theme directory (if the theme is /themes/bob/, you type bob) and the theme is set up for you according to the settings in it's configuration file (YAML format, so it's similar to an INI file).

    Article system:
    Articles are supported to some extent.
    I still have to finish the code for removing and editing them and the front-end is pretty basic at the moment, but it does work.
    I just have to pretty it up and get categories working.

    Cleaning:
    I've cleaned some things up and made things look a little better, including fixing some of the XHTML code to make it more compliant (which ended up with me hacking some of the code from LoginEngine so that it stops trying to print tables into my code).

    Front page redirection:
    I've been trying to make it possible to show either the blog \ news post list or one of the extra pages on the base URL (www.something.com/) rather than having to go to something.com/list or something.com/page/this, but I'm having a bit of a problem with this due to limitations in Rails' action rendering, which doesn't allow for extra parameters, meaning I have to redirect when using pages.
    PHP, CSS, XHTML, Delphi, Ruby on Rails & more.
    Current project: CMS Object.
    Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
    Release date: NEVER!!!
Sign In or Register to comment.