General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 23rd, 2003, 05:01 PM
mph mph is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 12 mph User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 sec
Reputation Power: 0
Question ForceType + Multiple Queries

PHP Code:
<?php

        $nav 
$_SERVER["REQUEST_URI"];
        
$script $_SERVER["SCRIPT_NAME"];
        
$nav ereg_replace("^$script"""$nav);
        
        
$vars explode("/"$nav);
        
$page "";
        
        
$dbServer "localhost";
        
$dbName "mikesite";
                        
        
$dbUser "poop";
        
$dbPass "corn";
                        
        
$svrConn mysql_connect($dbServer$dbUser$dbPass);
        
$dbConn mysql_select_db($dbName$svrConn);


    switch(
sizeof($vars))
    {
        case 
2:
            
$page $vars[1];
            break;
        }

    if(
$page == "" || $vars[1] == "site")
        {
                require(
'http://localhost/mike/v5/site/linkerror');
        }
        else if(
$page != "")
        {
                
// Show the page data
                
GetPage($page);
        }
                
        function 
GetPage($PageName)
        {
                
$result mysql_query("select * from content, template where title='$PageName'");
                if(
$row mysql_fetch_array($result))
                {
                        
// Show page data
                        
?>
        <? echo $row["top"]; ?>
        <font size="-1"><? echo nl2br($row["content"]); ?></font>
        <p>
        <font size="-2">Page Published <? echo $row["timestamp"]; ?>.</font>
        <? echo $row["bottom"]; ?>
<?

     
else if($page == "" || $vars[1] == "blog")
        {
                require(
'http://localhost/mike/v5/site/linkerror');
        }
        else if(
$page != "")
        {
                
// Show the page data
                
GetBlog($page);
        }
                
        function 
GetBlog($BlogName)
        {
                
$result mysql_query("select * from blog, template where timestamp='$BlogName'");
                if(
$row mysql_fetch_array($result))
                {
                        
// Show page data
                        
?>
        <? echo $row["top"]; ?>
        <font size="-1"><? echo nl2br($row["content"]); ?></font>
        <p>
        <font size="-2">Page Published <? echo $row["timestamp"]; ?>.</font>
        <? echo $row["bottom"]; ?>
                        <?php
                
}
                else
                {
                 
?>
        <? require('http://localhost/mike/v5/site/404'); ?>
<?
}
}
?>


Okay, when I do that, I get an error. What I want to do, is use this one file, 'v5' to run the entire site, rather than have multiple files like 'v5'. I would like it to check the variable and use that vcariables select statement.

Also, with the 'blog' section, I want the pages to be pulled up like this:

http://localhost/mike/v5/blog/01/30/03

but the data from the blog field 'timestamp' is saved with the datetime feature of mysql.

Please help me. Thanks!

Last edited by mph : August 23rd, 2003 at 05:20 PM.

Reply With Quote
  #2  
Old August 24th, 2003, 04:30 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
For forcetype, have you read the article written by Joe O'Donnell?

Using ForceType For Nicer Page URLs
http://www.devarticles.com/art/1/143

i found that article helped me a lot.


regarding the date, i guess you'll have to combine the three page parameters accordingly and name it "$BlogName"

Reply With Quote
  #3  
Old August 25th, 2003, 04:36 PM
mph mph is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 12 mph User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 sec
Reputation Power: 0
I have read the article on this site.

I still need help.

Reply With Quote
  #4  
Old August 25th, 2003, 08:02 PM
digitalamit digitalamit is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: New Delhi, India
Posts: 19 digitalamit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to digitalamit Send a message via AIM to digitalamit Send a message via Yahoo to digitalamit
Ok, goto the mike directory and create .htaccess with the following content
Code:
<Files v5>
ForceType application/x-httpd-php
</Files>


This should actually make the v5 to be able to run the whole site ...

HTH!

Reply With Quote
  #5  
Old August 26th, 2003, 01:20 PM
mph mph is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 12 mph User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 sec
Reputation Power: 0
Wow...

I have done EVERYTHING the article tells me to. I need help with the PHP end of it all. I get an error with the PHP code.

Could someone look that over and tell me what I am doing wrong?

Reply With Quote
  #6  
Old August 26th, 2003, 07:51 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
well, what's the error you're getting?

Reply With Quote
  #7  
Old August 27th, 2003, 09:20 PM
mph mph is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 12 mph User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 sec
Reputation Power: 0
Parse error: parse error in /www/mike/v5 on line 51

Reply With Quote
  #8  
Old August 28th, 2003, 07:00 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Looks like you're not closing

PHP Code:
if($row mysql_fetch_array($result)) 


before your else if in the GetPage() function.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > ForceType + Multiple Queries


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT