Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions

Reply
 
Thread Tools Display Modes
  #11  
Old 07-29-2002, 05:33 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$action is something that PHP automatically does for you, when you do URL.php?action=WHATEVER...it doesn't have to be action either it could be URL.php?url=WHATEVER then you would just replace $action with $url, anyways this is what I do...

PHP Code:
print "<a href=\"index.php?action=forums\">Forums</a>"
print "<a href=\"index.php?action=news\">News</a>"

then do on index.php

if ($action == "forums") {
  
header ("Location: h ttp://www.URL.com/forum"//redirects you to the URL
} elseif ($action == "news") {
       include (
"news.php"//includes the page

take out the space between the h and the ttp: hopes this helps.
Reply With Quote
  #12  
Old 07-29-2002, 01:49 PM
proxyMX's Avatar
proxyMX proxyMX is offline
 
Join Date: Jun 2002
Location: Seven of Nine is hot! :do
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i used this to set the homepage as a default. However its not as efficent as id like. You see the problem im having is that i want to set the action of main
if ($action == "home") {
include ("http://www.proxymx.com/main.php");
as the loaded include when you load index.php
so i set it out like so

if ($action == "home") {
include ("http://www.proxymx.com/main.php");
} elseif ($action == "legal") {
include ("http://www.proxymx.com/legal.php");
}
else include ('http://www.proxymx.com/main.php');

However, this presents a problem, if a page isnt found on request, it simply directs the user back to the mainpage.

What i want to do is when a user enters the site {index.php} i want them to see the main.php page included. And then use actions such as ?action=forums for other pages
the code i used is sufficent to do so, however if ever a page is not found, it simply returns to the mainpage, when i want it to display the standard error pages if a page is not found.

So in short what i want to do is set the main.php as the default include when a user loads index.php, However if they type the wrong action i want the standard error messages to show up
Reply With Quote
  #13  
Old 07-29-2002, 05:40 PM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well you could try this

PHP Code:
if ($action == "home") {
include (
"http://www.proxymx.com/main.php");
} elseif (
$action == "legal") {
include (
"http://www.proxymx.com/legal.php");
} else{
include (
"404.html"); 
then you just upload the 404.html (or .htm i dunno) from you comp to the site and that's what will get displayed if the page isn't found. if you can't find the 404.html just type in a random URL and when the 404 error comes up just go File/Save As...
Reply With Quote
  #14  
Old 07-30-2002, 11:08 PM
proxyMX's Avatar
proxyMX proxyMX is offline
 
Join Date: Jun 2002
Location: Seven of Nine is hot! :do
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

defeats the purpose :P
Reply With Quote
  #15  
Old 07-31-2002, 04:46 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

no it doesn't because it's saying if it doesn't find the page display an error, it just takes a little bit more work and it does exactly what u wanted it to do.
Reply With Quote
  #16  
Old 07-31-2002, 07:14 PM
proxyMX's Avatar
proxyMX proxyMX is offline
 
Join Date: Jun 2002
Location: Seven of Nine is hot! :do
Posts: 294
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

But then there would be no way to set the home as a deafult
Reply With Quote
  #17  
Old 08-01-2002, 12:54 AM
mr e's Avatar
mr e mr e is offline
 
Join Date: Dec 2001
Posts: 461
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Then try this

PHP Code:
if ($action == "home") {
include (
"http://www.proxymx.com/main.php");
} elseif (
$action == "") {
include (
"http://www.proxymx.com/main.php");
} elseif (
$action == "legal") {
include (
"http://www.proxymx.com/legal.php");
} else{
include (
"404.html"); 
there, i believe that solves your problem.
Reply With Quote
Reply

Thread Tools
Display Modes

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 02:21 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.03862 seconds
  • Memory Usage 2,225KB
  • Queries Executed 13 (?)
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
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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_postinfo_query
  • fetch_postinfo
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete