1
pipwax
External Database Driven Pages
  • 2006/4/19 23:45

  • pipwax

  • Not too shy to talk

  • Posts: 132

  • Since: 2005/9/12


I am trying to create a method to display my events on http://www.sk8photos.com > events. I have created a database page http://www.sk8photos.com/show_records.php can I copy the code and paste it into a block to get it to work?
pipwax1@bellsouth.net
Quote:
To win in life one must be fluid like water, taking the shape needed to prevail


aspring IT Professional

2
peterr
Re: External Database Driven Pages
  • 2006/4/20 2:28

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


Short answer, ..yes.

See Can I include my own HTML pages in xoops? , which is for a html page, your php page is much the same ......

include("path/to/mainfile.php");
include(
XOOPS_ROOT_PATH."/header.php");

// All the content of your current php file goes here

include(XOOPS_ROOT_PATH."/footer.php");
?>


(I _think_ ??)
NO to the Microsoft Office format as an ISO standard.
Sign the petition

3
pipwax
Re: External Database Driven Pages
  • 2006/4/21 0:21

  • pipwax

  • Not too shy to talk

  • Posts: 132

  • Since: 2005/9/12


Quote:

peterr wrote:
Short answer, ..yes.

See Can I include my own HTML pages in xoops? , which is for a html page, your php page is much the same ......

include("path/to/mainfile.php");
include(
XOOPS_ROOT_PATH."/header.php");

// All the content of your current php file goes here

include(XOOPS_ROOT_PATH."/footer.php");
?>


(I _think_ ??)


I tryied that but however, I guess I forgot to tell you that I made my database page using Dreamweaver and as you see it works fins as a standalone but i can't get XOOPS to wrap around this database page.

=========================My code=========================


$maxRows_allevents = 5;
$pageNum_allevents = 0;
if (isset($_GET['pageNum_allevents'])) {
$pageNum_allevents = $_GET['pageNum_allevents'];
}
$startRow_allevents = $pageNum_allevents * $maxRows_allevents;

mysql_select_db($database_SkateEvents, $SkateEvents);
$query_allevents = "SELECT * FROM events ORDER BY `Date` ASC";
$query_limit_allevents = sprintf("%s LIMIT %d, %d", $query_allevents, $startRow_allevents, $maxRows_allevents);
$allevents = mysql_query($query_limit_allevents, $SkateEvents) or die(mysql_error());
$row_allevents = mysql_fetch_assoc($allevents);

if (isset($_GET['totalRows_allevents'])) {
$totalRows_allevents = $_GET['totalRows_allevents'];
} else {
$all_allevents = mysql_query($query_allevents);
$totalRows_allevents = mysql_num_rows($all_allevents);
}
$totalPages_allevents = ceil($totalRows_allevents/$maxRows_allevents)-1;
?>




Events Page




















Date
Events
Host
More info
Host id
Click Here



mysql_free_result($allevents);
?>
=========================end code======================
pipwax1@bellsouth.net
Quote:
To win in life one must be fluid like water, taking the shape needed to prevail


aspring IT Professional

4
peterr
Re: External Database Driven Pages
  • 2006/4/21 0:35

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


From first looking at the code, the while staement should be up the top somewhere shouldn't it ? Also, there is no closing brace on the while statement ?

I wouldn't use Dreamweaver to create php code either, I've heard some horrar stories.

edit: .. oops, I didn't so the php 'do'. lol

When you try wrapping the XOOPS code around it, what does it do, any error messages ?
NO to the Microsoft Office format as an ISO standard.
Sign the petition

5
pipwax
Re: External Database Driven Pages
  • 2006/4/21 1:01

  • pipwax

  • Not too shy to talk

  • Posts: 132

  • Since: 2005/9/12


I get a blank page wraped in Xoops.
pipwax1@bellsouth.net
Quote:
To win in life one must be fluid like water, taking the shape needed to prevail


aspring IT Professional

6
peterr
Re: External Database Driven Pages
  • 2006/4/21 1:15

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


What does your php error log say ?
NO to the Microsoft Office format as an ISO standard.
Sign the petition

7
pipwax
Re: External Database Driven Pages
  • 2006/4/21 14:27

  • pipwax

  • Not too shy to talk

  • Posts: 132

  • Since: 2005/9/12


I am not sure what that means. However, This simple page works so why can't i just use the include statement?


$maxRows_allevents = 5;
$pageNum_allevents = 0;
if (isset($_GET['pageNum_allevents'])) {
$pageNum_allevents = $_GET['pageNum_allevents'];
}
$startRow_allevents = $pageNum_allevents * $maxRows_allevents;

mysql_select_db($database_SkateEvents, $SkateEvents);
$query_allevents = "SELECT * FROM events ORDER BY `Date` ASC";
$query_limit_allevents = sprintf("%s LIMIT %d, %d", $query_allevents, $startRow_allevents, $maxRows_allevents);
$allevents = mysql_query($query_limit_allevents, $SkateEvents) or die(mysql_error());
$row_allevents = mysql_fetch_assoc($allevents);

if (isset($_GET['totalRows_allevents'])) {
$totalRows_allevents = $_GET['totalRows_allevents'];
} else {
$all_allevents = mysql_query($query_allevents);
$totalRows_allevents = mysql_num_rows($all_allevents);
}
$totalPages_allevents = ceil($totalRows_allevents/$maxRows_allevents)-1;
?>



Untitled Document





pipwax1@bellsouth.net
Quote:
To win in life one must be fluid like water, taking the shape needed to prevail


aspring IT Professional

8
pipwax
Re: External Database Driven Pages
  • 2006/4/21 15:04

  • pipwax

  • Not too shy to talk

  • Posts: 132

  • Since: 2005/9/12


Ok guys and gals I have a code that works, and now I am looking for constructive comments.

++++++++++++++++here's the code++++++++++++++++++++++++++++

include("mainfile.php");
include(XOOPS_ROOT_PATH."/header.php");
?>

$maxRows_allevents = 5;
$pageNum_allevents = 0;
if (isset($_GET['pageNum_allevents'])) {
$pageNum_allevents = $_GET['pageNum_allevents'];
}
$startRow_allevents = $pageNum_allevents * $maxRows_allevents;

mysql_select_db($database_SkateEvents, $SkateEvents);
$query_allevents = "SELECT * FROM events ORDER BY `Date` ASC";
$query_limit_allevents = sprintf("%s LIMIT %d, %d", $query_allevents, $startRow_allevents, $maxRows_allevents);
$allevents = mysql_query($query_limit_allevents, $SkateEvents) or die(mysql_error());
$row_allevents = mysql_fetch_assoc($allevents);

if (isset($_GET['totalRows_allevents'])) {
$totalRows_allevents = $_GET['totalRows_allevents'];
} else {
$all_allevents = mysql_query($query_allevents);
$totalRows_allevents = mysql_num_rows($all_allevents);
}
$totalPages_allevents = ceil($totalRows_allevents/$maxRows_allevents)-1;
?>




Events Page




















Date
Events
Host
More info
Host id
Click Here



mysql_free_result($allevents);
include(XOOPS_ROOT_PATH."/footer.php");

?>
+++++++++++++++++++++end code++++++++++++++++++++++++++++++

I had to load the page up in the directory xoops/html/show_records.php I will have to tweak the page and refer to the css file with in the theme but how will I like the page to the navigation to make it look all the same. I also need to fix the link so that each link will point to a flyer.

View results here

Thanks guys.
pipwax1@bellsouth.net
Quote:
To win in life one must be fluid like water, taking the shape needed to prevail


aspring IT Professional

9
peterr
Re: External Database Driven Pages
  • 2006/4/22 0:59

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


Quote:

pipwax wrote:
I am not sure what that means.


Run a php script with the phpinfo() function in it, and you will see an entry "error_log", that is where your php error log is.
NO to the Microsoft Office format as an ISO standard.
Sign the petition

10
peterr
Re: External Database Driven Pages
  • 2006/4/22 1:10

  • peterr

  • Just can't stay away

  • Posts: 518

  • Since: 2004/8/5 9


Quote:

pipwax wrote:
Ok guys and gals I have a code that works, and now I am looking for constructive comments.


1. There will be more load on the server 'turning php on and off' unecessarily. The first few lines of code need to be replaced by ...

include("mainfile.php");
include(
XOOPS_ROOT_PATH."/header.php");

require_once(
'Connections/SkateEvents.php');
$maxRows_allevents 5;


2. Remove this code at the top ..

DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<
html>
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<
title>Events Pagetitle>
head>
<
body>


and this code at the bottom, ..

body>
html>


it's not needed.
NO to the Microsoft Office format as an ISO standard.
Sign the petition

Login

Who's Online

412 user(s) are online (58 user(s) are browsing Support Forums)


Members: 0


Guests: 412


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Oct 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits