Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-21-2010, 11:52 AM
Sadikb's Avatar
Sadikb Sadikb is offline
 
Join Date: Aug 2008
Location: Internet
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to create a custom CMS page

Hi,

I know there's the PHP Direct Evaluation Content Type, but the content / article one can create with it remains under the cms section. That is, the url will be content.php?... etc.

I want a separate php page, something like www.mysite.com/mypage.php

On this php page I want to display CMS widgets. Now I can create a custom page and display VB Header, navbar, footer just fine using this article as a reference point, but obviously I won't be able to display the CMS widgets in this, or can I? if yes, how? if no, is there any way?

Thanks for reading...
Reply With Quote
  #2  
Old 11-21-2010, 12:22 PM
Alfa1's Avatar
Alfa1 Alfa1 is offline
 
Join Date: Dec 2005
Location: Netherlands
Posts: 3,537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The CMS seems to lack any flexibility or functionality in this regard at this time.
Reply With Quote
  #3  
Old 11-22-2010, 04:24 AM
Sadikb's Avatar
Sadikb Sadikb is offline
 
Join Date: Aug 2008
Location: Internet
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Alfa,

I found a way, but i am still testing. I will hopefully paste the code if I am able to achieve this.
Reply With Quote
  #4  
Old 11-23-2010, 02:49 PM
FReeSTER FReeSTER is offline
 
Join Date: Jun 2006
Location: Rome
Posts: 730
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I will follow up on this, I will love to do the same but Im bad with variables. Im trying to archive a page like this one here http://www.minatica.be/content/
but I have no clue where to start from. I seen many sites getting this done but unfortunately for me is not the case.
Reply With Quote
  #5  
Old 11-25-2010, 05:20 PM
Sadikb's Avatar
Sadikb Sadikb is offline
 
Join Date: Aug 2008
Location: Internet
Posts: 111
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually I gave up on the idea as it was too much work and I had little time. But it can be done. This is how to do it,

The following is code of a sample custom page, which has the VB header, navbar and footer and CMS Widgets as it's main content. The page is far from finished, like I said I abondoned the idea of implementing this. I am sharing the code so that if someone else wants to do this he has a starting point.

PHP Code:
<?

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################

define('THIS_SCRIPT', 'test');
define('CSRF_PROTECTION', true);  
// change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();

// get special data templates from the datastore
$specialtemplates = array();

// pre-cache templates used by all actions
$globaltemplates = array('TEST',
);

// pre-cache templates used by specific actions
$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################
// if your page is outside of your normal vb forums directory, you should change directories by uncommenting the next line
// chdir ('/path/to/your/forums');
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits = construct_navbits(array('' => 'Test Page'));
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = 'My Page Title';


// ##### INCLUDE WIDGETS #####

require_once('./includes/class_bootstrap_framework.php');
vB_Bootstrap_Framework::init();
vBCms_View_Widget::registerTemplater(vB_View::OT_XHTML, new vB_Templater_vB());

$widgetID = 27; // the id of the widget, this you can get from the CMS_WIDGET table

$widgettype = 'RecentArticle'; // type of the widget you want to output, this is the Class Name, you can get this from packages/vbcms/widget folder. The file names are usually the same as classnames

$widget = vBCms_Widget::create('vBCms', $widgettype, $widgetID);
$output = $widget->getPageView()->render();  

// ###### NOW YOUR TEMPLATE IS BEING RENDERED ######

$templater = vB_Template::create('TEST');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('pagetitle', $pagetitle);
$templater->register('widget', $output);
print_output($templater->render());


?>
You will obviously run into styling issues as your widget css would not be available for the custom page, but i didn't spend time on that.

--------------- Added [DATE]1290712997[/DATE] at [TIME]1290712997[/TIME] ---------------

Quote:
Originally Posted by El Intocable View Post
I will follow up on this, I will love to do the same but Im bad with variables. Im trying to archive a page like this one here http://www.minatica.be/content/
but I have no clue where to start from. I seen many sites getting this done but unfortunately for me is not the case.
That's RS_Jelle's site. He's a very talented coder (Downloads II)...
Reply With Quote
  #6  
Old 04-13-2011, 02:01 PM
SkyStryder SkyStryder is offline
 
Join Date: Dec 2007
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The widgets do work in this example. Does anyone know how to
intialize {vb:raw layout}? That would be the next step which I am
trying to work out now.

Thank you!
Rick
Reply With Quote
  #7  
Old 04-18-2011, 02:28 AM
wheretobet wheretobet is offline
 
Join Date: Nov 2008
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why raw layout?

Shouldn't it be {vb:raw output}

I have tested this but I don't see that cms widgets work on custom pages
Reply With Quote
  #8  
Old 04-19-2011, 07:51 AM
Disasterpiece's Avatar
Disasterpiece Disasterpiece is offline
 
Join Date: Apr 2007
Location: GER
Posts: 765
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If it's just for the url's sake, you can create a url rewrite in your .htaccess so http://whatever.tld/foo.php
directs to http://whatever.tld/content.php?id=9001
it's actually pretty easy if you google it up (try "url rewrite htaccess")
this would spare you the hacking/coding and you'd keep the benefits of the vbcms like editor, modifyable site, etc.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:43 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04253 seconds
  • Memory Usage 2,235KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete