vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO - vB4] Create your own vBulletin page (https://vborg.vbsupport.ru/showthread.php?t=228112)

MacroPhotoPro 03-30-2012 06:17 PM

Quote:

Originally Posted by Rocket2009 (Post 2311385)
I don't know about methods (1) and (2). As suggested elsewhere in this thread I effectively use a little code in the php page (not the vBulletin template). Mine looks like:

PHP Code:

// #######################################################################

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

// #######################################################################

if (!is_member_of($vbulletin->userinfo67515139111612))  
{
// give no permission unless in usergroup x, y, or z
        
print_no_permission();
}  

$navbits construct_navbits(array('' => 'TMGA Logos'));

$navbar render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE ##### 




How about a variation on this that also employs create/edit/delete permissions?

For example, in the other custom pages I want to design, these are going to be for an image-hosting service I am making. I want people to pay a fee to host their images, and I want "everyone" to be able to "see" these images, but where only the Administrator and Paid Subscibers can edit, delete, or create new pages.

Further, the permissions should be configured to where Paid Subscribers are only able to edit/delete their own self-created pages, but to where they can't edit/delete the pages of other Paid Subscribers, while the Administrator can edit/delete anyone's pages.

I know how to do this with my CMS Manager, but because these custom pages we're here aren't controlled by that, how would they be thus-configured by hand?

Thanks!

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

Quote:

Originally Posted by Lynne (Post 1915364)
2. Create the Template:
- If you are in debug mode, create the template in your MASTER STYLE so it shows up in all your styles, otherwise make sure you create the template in the style you are using. If following the page above, call the template TEST

How do I operate in debug mode, and will this still work if I am not?

cbiweb 04-03-2012 01:02 PM

I've created the page, and everything works except that users are no longer logged in when visiting the custom page. Clicking any tab or link to navigate away from the page brings me back to the normal logged in state, but the custom page is logged out. How do I fix that?

edit: Found the problem. It's a privacy policy page, and in Options > Site Name / URL / Contact Details the link to the page was the full path (http://sitename.com/forums/privacy.php) instead of relative (privacy.php). Once I made it relative it worked fine.

MacroPhotoPro 04-03-2012 03:58 PM

Code:

<?php

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

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

define('THIS_SCRIPT', 'scrImages');
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('IMAGE_HOSTING',
);

// 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('' => 'Macro Image Hosting'));
$navbar = render_navbar_template($navbits);

// ###### YOUR CUSTOM CODE GOES HERE #####
$pagetitle = '';
echo 'I am here';

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

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

?>


Okay, I have followed your instructions in this tutorial to the letter and am getting a blank test page to generate just fine.

However, the moment I try to add custom code to it, the setup fails. I just did a basic "I am here" insertion, but where you have indicated Your Custom Code Goes Here is generating the quote at the TOP of my test page, rather than in the body where it should be, as follows:


What am I doing wrong and why is the "I am here" quote being displayed at the top of the page, rather than in the body where it should be going?

Thanks for any help!

Jack

Lynne 04-03-2012 04:27 PM

You need to insert any text you want on the page into the template. You cannot use echo. You would need to do something like:
PHP Code:

$message 'I am here'

and in the appropriate place near the bottom, add:
PHP Code:

$templater->register('message'$message); 

And then in the template, put this where you want the text to appear:
HTML Code:

{vb:raw message}

MacroPhotoPro 04-03-2012 05:38 PM

Okay, I have that bit working right now, thank you.

In order to create an actual page now, can I just use HTML tags, or do I have to register more code with the template?

Thanks again.

Lynne 04-03-2012 11:39 PM

If you have static content for your page, you may just want to type it into the template directly. Using variables is usually something you'd only want to do if you are using php to define some text.

MacroPhotoPro 04-04-2012 01:57 AM

Quote:

Originally Posted by Lynne (Post 2316554)
If you have static content for your page, you may just want to type it into the template directly. Using variables is usually something you'd only want to do if you are using php to define some text.

Okay thank you. Moving on from a basic block of text, what if I just want to make a basic HTML template within my custom page? For example:

Code:

<h1>My Title</h1>

My text

<ul>
  <li>Cameras</li>
    <ul>
      <li>DSLRs</li>
      <li>Point & Shoot</li>
    </ul>
  <li>Lenses</li>
  <li>Etc.</li>
</ul>

More text.

<a href="mailto:myemail">My Email</a>

How would I set the template/php page up? In other words, you had me place {vb:raw imghost_content} just to put "I am here," what kind of variable would I need to add to construct a basic HTML page?

Thanks again!!

cellarius 04-04-2012 05:15 AM

Use the template code given in the article to create a custom vBulletin page. To just create any html page (without showing the forum framework) use standard html page architecture (basically, you'll find that in the template code in the article, too).

MacroPhotoPro 04-04-2012 12:59 PM

Quote:

Originally Posted by cellarius (Post 2316603)
Use the template code given in the article to create a custom vBulletin page. To just create any html page (without showing the forum framework) use standard html page architecture (basically, you'll find that in the template code in the article, too).

I placed the simple code I put up top in the "your code goes here" element of the .php page, and my text showed up, but my HTML did not.

I assume I am missing something :confused:

Lynne 04-04-2012 02:05 PM

Quote:

Originally Posted by MacroPhotoPro (Post 2316673)
I placed the simple code I put up top in the "your code goes here" element of the .php page, and my text showed up, but my HTML did not.

I assume I am missing something :confused:

Please give us a URL to view the page. My guess is the HTML did show up, but your CSS is causing it to not do what you want.

Search this article for discussions on the problems using <li> on this page and the CSS you need to add to fix it.


All times are GMT. The time now is 09:29 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02665 seconds
  • Memory Usage 1,765KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_html_printable
  • (3)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete