vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Creating Page Within Page? (https://vborg.vbsupport.ru/showthread.php?t=201015)

MarkFoster 01-07-2009 11:07 PM

Creating Page Within Page?
 
How do I create a page within a page for example: www.example.com/example.php?do=news
Or something like: www.example.com/example.php?action=news

I really need this soon so any help appreciated.

Bellardia 01-07-2009 11:15 PM

Use php $_GET['do'] and $_GET['action'] to get the query string.
Use an if condition...if ($_GET['do'] == 'something') { DO THIS } else { DO THIS } etc

Of course, this would be done in php.

MarkFoster 01-07-2009 11:28 PM

Quote:

Originally Posted by Bellardia (Post 1704613)
Use php $_GET['do'] and $_GET['action'] to get the query string.
Use an if condition...if ($_GET['do'] == 'something') { DO THIS } else { DO THIS } etc

Of course, this would be done in php.

Could you make it in a quote what I should add?

I tried this many times without anything at all working
Quote:

if ($_REQUEST['do'] == 'xxx')
{
eval('print_output("' . fetch_template('TEMPLATE_XXX') . '");');
}

Bellardia 01-07-2009 11:53 PM

$_REQUEST is a very different function than $_GET.

Not sure what exactly you want to do with the code, so I won't tell you want to evaluate inside or anything...but to do something based on the query string use the code

PHP Code:

if ($_GET['do'] == 'Something')
{
   
//do something



MarkFoster 01-08-2009 12:47 AM

Quote:

Originally Posted by Bellardia (Post 1704638)
$_REQUEST is a very different function than $_GET.

Not sure what exactly you want to do with the code, so I won't tell you want to evaluate inside or anything...but to do something based on the query string use the code

PHP Code:

if ($_GET['do'] == 'Something')
{
   
//do something



But if I do like this:
PHP Code:

if ($_GET['do'] == '?newsmain1')
{
[
B]   //do something[/B]


What will the command be to load a template and that template only, not the template that is on.com/name.php[S]?newsmain1[/S] ?

Bellardia 01-08-2009 01:05 AM

You leave the '?' out of the $_GET command.

I advise you ask someone to do this for you, as you don't know PHP. You cant use bb code in php, nor html (directly).
Although a relatively simple task, would take awhile to explain from scratch, especially when unaware of your intentions. I would advise checking out some php tutorials.

Lynne 01-08-2009 01:06 AM

Don't put the question mark in the if statement ('newsmain1' only) Try your if statement with that correction.

MarkFoster 01-08-2009 01:13 AM

Quote:

Originally Posted by Bellardia (Post 1704687)
You leave the '?' out of the $_GET command.

I advise you ask someone to do this for you, as you don't know PHP. You cant use bb code in php, nor html (directly).
Although a relatively simple task, would take awhile to explain from scratch, especially when unaware of your intentions. I would advise checking out some php tutorials.

All I really need is one PHP command which will let me add a page within a PHP file with my own template.
And that's about it so I'm pretty sure somebody has a code for that.

Bellardia 01-08-2009 01:20 AM

PHP Code:

if ($_GET['do'] == 'Something')
{
   include(
'PAGENAME.HTML');


Change 'something' to what will be after do=, ie, if your page is www.mypage.com?do=run, then change it to 'something'. Change $_GET['do'] to what is before the equal sign...you could make it www.mypage.com?returnpage=first, then you would used $_GET['returnpage']. Use the include to fetch a html/php page from the same directory, or link it appropriately.

Or fetch a template instead.

MarkFoster 01-08-2009 01:37 AM

Quote:

Originally Posted by Bellardia (Post 1704699)
PHP Code:

if ($_GET['do'] == 'Something')
{
   include(
'PAGENAME.HTML');


Change 'something' to what will be after do=, ie, if your page is www.mypage.com?do=run, then change it to 'something'. Change $_GET['do'] to what is before the equal sign...you could make it www.mypage.com?returnpage=first, then you would used $_GET['returnpage']. Use the include to fetch a html/php page from the same directory, or link it appropriately.

Or fetch a template instead.

I would rather fetch a template but this code wont work:
PHP Code:

if ($_GET['do'] == 'news1')
{
eval(
'print_output("' fetch_template('newsmain1') . '");'); 


Could you give me a exact fetch template line?


All times are GMT. The time now is 01:03 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.01925 seconds
  • Memory Usage 1,746KB
  • 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
  • (6)bbcode_php_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (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