vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Actions for includes in php (https://vborg.vbsupport.ru/showthread.php?t=41632)

proxyMX 07-28-2002 04:40 PM

Actions for includes in php
 
hi there,
i was wondering if there was any way i could simply use one page for includes, instead of having to save the normal way.

Normally youd alter the includes code to the specific page eg
index.php's includes would be indexinc.php,navigation.php,extras.php

news includes would be
newsinc.php, navigation.php,extras.php

Basically what i want to do is for every inc page of my site create an action from the main template that would display the unique included page to each

eg
index.php?action=news
would include newsinc.php and the navigation and extras files
index.php?action=freebies
would include freeinc.php and the navigation and extras files

anyway i can do this? im a total newbie to php

Xenon 07-28-2002 10:44 PM

not sure if i understand you the right way...

try this code:
PHP Code:

if(isset($action) and trim($action)!="") {
include(
$action."inc.php");
}
include(
"navigation.php");
include(
"extras.php"); 


proxyMX 07-29-2002 12:39 AM

Xenon, Lets have an affair, your an asset
So i would simply create a full compliment of links and type in their function? using
if
ifelse
if else
if else
if else?
it works tops, Im such a newb
By the way Xenon, could you tell me a good resource OTHER than php.net for tutorials
btw sorry for the triple post :eek:

proxyMX 07-29-2002 12:49 AM

Hmm nope, having problems now, can you tell me whats up with this code?
<? if(isset($action) and trim($action)!="home") {
include($action."main.php");
}
if else(isset($action) and trim($action)!="legal") {
include($action."legal.php");
}
?>

mr e 07-29-2002 01:04 AM

It's elseif not if else and I would just do...

PHP Code:

<?
if ($action == "home") {
  include ("main.php");
} elseif ($action == "legal") {
        include ("legal.php");
}
?>

or you could just try

<?
include ("$action.php")
?>

and just make sure the $action is the same name as the page your trying to include


proxyMX 07-29-2002 03:28 AM

Doh! Shows my talent in the php area then :P

proxyMX 07-29-2002 03:32 AM

by the way, i know the if and elseif statements and the include function, but can people explain actions to me please? and is it possible to set the include main action as the default

mr e 07-29-2002 03:42 AM

what do u mean actions? you could try www.php.net, but i dunno what you mean by actions.

proxyMX 07-29-2002 03:52 AM

Thanks for the update, its running more efficently now,

proxyMX 07-29-2002 03:58 AM

what i meab by actions is like
index.php?action=forums

or is that simply a user defined function?


All times are GMT. The time now is 03:44 AM.

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.01689 seconds
  • Memory Usage 1,734KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)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