View RSS Feed

Edwin Brown

New Content Types

Rating: 6 votes, 3.67 average.
I'm writing this to present a couple of features that will be in v404. I can't give you a date when this will be available because I don't have one. I'm expecting it will be fairly soon. The new features I'm talking about are two new content types- Static Page and PHP Evaluation. There have been a number of requests for both of these. I'm posting this in advance of the release so people can start thinking about how they would use this.

Static Page is fairly straightforward. You can enter any raw HTML for the page content, any raw HTML for the preview, and a link for a preview image. This is all totally open- you type anything you want in here. That obviously makes it really easy for anyone to break the page to do bad things, so we require HTML CMS permissions to create or edit one of these. Otherwise I can't think of much to say.

PHP Eval is far more complex, and the primary point of the discussion. This makes it relatively easy to do some cool stuff. I took my example from the post at http://www.vbulletin.com/forum/showt...tion-wise-quot. This requires some PHP code and two templates. Well, that's not the only way but I think it's the most straightforward. See the attachment for the details.

The challenge here is debugging. If you are going to write your own pages of this type you really need an offline development environment. When I was creating the specific summary page php content, I found that if I had two of these I created an interesting infinite-recursion loop. Page A needs the results of page B and can't return until it gets it, and page B needs the results of page A and can't return until it gets it. You don't want to discover this on your live site. If you have two of these, don't set "Display Full Article in Section Page" for either of them!

Another interesting use of this type would be to display the contents of a widget on a page. I've read several posts by people who want to render only the contents of an existing widget on a page. Here's the code to display a calendar widget as the primary page content:
$widget = vBCms_Widget::create('vBCms', 'Calendar', 8);

$output = $widget ->getPageView()->render();

Note that you have to know the parameters for the widget- package, class, and widgetid. My id is 8 - yours is likely to be something different.

For those of you who program PHP, this should give you some significant new options. For those of you who don't, I would hope and expect there will some interesting new page types on vBulletin.org.
Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	site_summary.jpg‎
Views:	1787
Size:	40.9 KB
ID:	45781   Click image for larger version

Name:	static_page.jpg‎
Views:	1630
Size:	61.2 KB
ID:	45782   Click image for larger version

Name:	php_eval_page.jpg‎
Views:	1372
Size:	68.7 KB
ID:	45783  
Attached Thumbnails Attached Files

Submit "New Content Types" to Digg Submit "New Content Types" to del.icio.us Submit "New Content Types" to StumbleUpon Submit "New Content Types" to Google

Updated Fri 11th Jun '10 at 10:40am by Edwin Brown

Categories
vBulletin CMS

Comments

Page 1 of 2 1 2 LastLast
  1. PitchouneN64ngc -
    PitchouneN64ngc's Avatar
    These 2 new content types will make a lot of users happier Thank you for this
  2. Gumble -
    Gumble's Avatar
    Great news i was waiting for one change like this to move forward with some ideas that bugging me for a while
  3. Dody -
    Dody's Avatar
    Looks very interesting. Are we allowed to use $_GET, $_POST & $_REQUEST?
  4. kmohamed -
    kmohamed's Avatar
    great waiting for the new release with less bugs please
  5. Edwin Brown -
    Edwin Brown's Avatar
    Quote Originally Posted by Dody
    Looks very interesting. Are we allowed to use $_GET, $_POST & $_REQUEST?
    Sure. It's PHP, totally unrestricted. You are running in the context of the item_content object, so you have access to variables like vB::$db, vB::$vbulletin, anything global, $this->nodeid, etc.

    EDIT: But of course we'd recommend you not access these directly. We always use the cleaned variables (vB::$vbulletin->input->clean_array_gpc()), and we would recommend you do the same.
    Updated Tue 27th Apr '10 at 10:47am by Edwin Brown
  6. TheLastSuperman -
    TheLastSuperman's Avatar
    Like a kid in candy store... step on it guys (I mean please hurry!)
  7. ragtek -
    ragtek's Avatar
    Yea,it's getting a end
    thx for releasing it direct in vB4

    And specially the HTML Type is really easy to use!
  8. Dody -
    Dody's Avatar
    Quote Originally Posted by Edwin Brown
    Sure. It's PHP, totally unrestricted. You are running in the context of the item_content object, so you have access to variables like vB::$db, vB::$vbulletin, anything global, $this->nodeid, etc.
    Awsome. I assume that it is also possible to create a custom rewriterule that bypasses the get/post/request vars to PHP page, like the following:

    /content.php/1-my-PHP-page/2/3 where 2 and 3 are the get variables
  9. deityx -
    deityx's Avatar
    This is great news. Thanks a bunch.
  10. Mr_Bob -
    Mr_Bob's Avatar
    Edwin, can you speak a little more on how static pages will be organized? From your language, it looks like we'll have access to the content editor, but options showing only that pertain to static pages (so, no comments). I only ask because I'm curious how breadcrumbs will work. Will static pages be part of a content section, or will they rather be like Wordpress static pages where you would have one static page, and can add another static page as that static page's child (so breadcrumbs would read Static Page 1>Static Page 2, with Static Page 2 being the child of Static Page 1)? If it runs like Wordpress, you guys get crazy props from me forever .

    Besides, this is already great news. My actual content pages will no longer be confused with articles and user submissions in the search feed .
  11. Edwin Brown -
    Edwin Brown's Avatar
    Quote Originally Posted by Mr_Bob
    Edwin, can you speak a little more on how static pages will be organized? From your language, it looks like we'll have access to the content editor, but options showing only that pertain to static pages (so, no comments). I only ask because I'm curious how breadcrumbs will work. Will static pages be part of a content section, or will they rather be like Wordpress static pages where you would have one static page, and can add another static page as that static page's child (so breadcrumbs would read Static Page 1>Static Page 2, with Static Page 2 being the child of Static Page 1)? If it runs like Wordpress, you guys get crazy props from me forever .

    Besides, this is already great news. My actual content pages will no longer be confused with articles and user submissions in the search feed .
    Sorry, but in our current CMS the hierarchy is based on sections. Only sections can have children. I suppose it would be possible to have a category named "Static Page 1" with a static page labeled "Static Page 1" inside it, and another category named "Static page 2" with a static page named "Static Page 2" inside it. That would give the breadcrumbs you want, but it sure is an ugly solution. I think a better one would be to expand the current section to allow it to have its own rendered content. It wouldn't be difficult, but it's not available today. I'm curious- could other people weigh in? Is this something the community thinks is important?

    Yes, you can comment on these new types. The Static Page is indexable, so it is searchable in the v4 search, and you could create a general search widget that displays static pages. We also created a new "recent content" widget that treats articles, static pages, php eval pages, and whatever other types we or the community create as if they were articles.

    I didn't make php eval pages indexable. Its content will be constantly changing so that didn't make sense to me.
    Updated Tue 27th Apr '10 at 10:52am by Edwin Brown
  12. ragtek -
    ragtek's Avatar
    How will the Buttons be placed?
    Still 3 (article,php,static) or like in the alpha phase?
  13. Edwin Brown -
    Edwin Brown's Avatar
    It's a dropdown now with a "go" button.
  14. Steven72555 -
    Steven72555's Avatar
    Is v404 going to breK MY STYLES like the past updates?
  15. ragtek -
    ragtek's Avatar
    Quote Originally Posted by Edwin Brown
    It's a dropdown now with a "go" button.
    Jea, sounds good

    thx for the great work
  16. Edwin Brown -
    Edwin Brown's Avatar
    Quote Originally Posted by Steven72555
    Is v404 going to breK MY STYLES like the past updates?
    You're asking the wrong person. I'm too busy breaking CMS to have time to break styles too.
  17. ragtek -
    ragtek's Avatar
    lol
  18. ragtek -
    ragtek's Avatar
    Edwin, I'm missing something in youre example code!
    You have 2 queries, but you don't call vB::$db->free_result()
  19. steven s -
    steven s's Avatar
    Forgive me but is this so we can create an article on the lines how we use the php executable widget?
  20. Edwin Brown -
    Edwin Brown's Avatar
    Quote Originally Posted by steven s
    Forgive me but is this so we can create an article on the lines how we use the php executable widget?
    Precisely.
Page 1 of 2 1 2 LastLast

Trackbacks

Total Trackbacks 0
Trackback URL: