Spidean  

The home of the AutoTheme HTML Theme System: PHP-Nuke Themes, phpNuke Themes, PostNuke Themes, Zikula Themes, Platinum Nuke Themes, Nuke Evolution Themes, Smeego Themes

 
 
Pinnacle of Excellence  

FAQ

SUPPORT

THEMES

TEMPLATES

   
   

   
Main Menu

Purchase AutoTheme
Buy Now
 
Welcome Guest   Register | Log in



Spidean Forums
You are not logged in

 < Last Thread   Next Thread >Ascending sortDescending sorting  New Topic  Post Reply
Author: Subject: Pulling PN content into static html

Newbie





Posts: 8
Registered: 11/12/2002
Status: Offline

  posted on 11/2/2004 at 03:38 PM
This isn't Autotheme related but i'm hoping someone here will be able to help.

I have designed a static login screen and a user signup screen for PN in bog standard HTML.

I'd like to be able to include a line within my static html that says something like 'Welcome to MySite - XXXXXX users can't be wrong!' Where the 'XXXXX' is replaced by the actual number of users in the database. I'd like to be able to do similar things with the forums too.

The reason I don't want to do this directly with PostNuke is because the site is VERY customised and PN just gets in the way.

Anyone have any idea how to do this?

[Edited on 2/11/2004 by starteck2002]

 
Reply With Quote

Senior Member




Posts: 217
Registered: 7/31/2004
Status: Offline

  posted on 11/7/2004 at 05:52 PM
Insert this code into theme.html where ever you want it to appear.

code:
<?php
list($dbconn) = pnDBGetConn();
$pntable = pnDBGetTables();
$UsersTable = $pntable['users'];
$UsersColumn = &$pntable['users_column'];
$sql = "SELECT $UsersColumn[uname]
FROM $UsersTable
WHERE $UsersColumn[uname]
NOT LIKE 'Anonymous'
ORDER BY $UsersColumn[uid] DESC";
$result = $dbconn->Execute($sql);
if ($dbconn->ErrorNo() != 0) { return; }
$total = $result->PO_RecordCount();
$result->Close();
echo 'Welcome to mysite.com! ' . ' ' . $total . ' users can\'t be wrong!';
?>


I find it funny that you think PN gets in the way, but are willing to display a statistic in this way... to each his own.

John

 

____________________
»AlarConcepts«

 
Reply With Quote

Newbie




Posts: 8
Registered: 11/12/2002
Status: Offline

  posted on 11/7/2004 at 05:59 PM
Hi John,

Thanks for the reply to my post. Just so that you understand, I have no problem with PostNuke - It's been the basis of my website now for around 3 years (i think).

What I am actually trying to do is have a static HTML page that is NOT related to postnuke in anyway but would like to pull info out of the PN DB and display it.

I want to be able to do this outside of postnuke. Is it possible?

 
Reply With Quote

Senior Member




Posts: 217
Registered: 7/31/2004
Status: Offline

  posted on 11/7/2004 at 09:39 PM
The problem is that you need to call the pninit() function in order to get access to any variables...but you can't do this in your html file...

Is is absolutely necessary that your html page have an .html extension? You can just create a PostNuke "wrapper" for any HTML you need to display...and by jumping in and out of PHP (within the HTML portion,) you can use any of PostNukes variables...

Two things to watch for:
1. The page with the code below MUST have a .php extension.
2. The page MUST reside in your root to work properly.

code:
<?
include 'includes/pnAPI.php';
pnInit();
include("header.php");
OpenTable();
?>
ALL YOUR HTML FITS IN HERE...BUT DON'T FORGET THAT YOU CAN BREAK IN AND OUT OF PHP AS YOU GO, FOR EXAMPLE:
My username is <?php echo pnUserGetVar('uname'); ?>!
<?php
CloseTable();
include 'footer.php';
?>


...or you try one of the wrapper or pagesetting modules...

John

 

____________________
» title="AlarConcepts">AlarConcepts«

 
Reply With Quote

Newbie




Posts: 1
Registered: 8/20/2005
Status: Offline

  posted on 8/20/2005 at 03:36 AM
quote:

You can just create a PostNuke "wrapper" for any HTML you need to display...



Thanks for that, John - that's done the job nicely.

I'm a total n00b to PHP, and trying to build a page to do some querying to a (non-directly-Nuke related) db. I'm getting there on that, and this snippet of code has enabled me to get the pages "within" 'Nuke, but...

The footers aren't working.

Instead of the usual ubiquitous 'Nuke footer and banner ad, I'm getting :-

quote:
Fatal error: Call to a member function on a non-object in /home2/cccuk/public_html/PostNuke/includes/pnBanners.php on line 50


I'm on PN 0.726, and I've not touched the code in footer.php or pnBanners.php at all.

Any suggestions? Ta.

[Edited on 20/8/2005 by Adrian_C]

 
Reply With Quote
New Topic    Post Reply


Powered by XForum 1.81 by Trollix Software

Printer Friendly Page Printer Friendly Page 
         



AutoTheme is an HTML Theme System currently supporting the Zikula, PostNuke, PHP-Nuke, MD-Pro Content Management Systems (CMS) and derivative Nukes, osCommerce and CRE Loaded shopping carts and the Wordpress blog.

PHP-Nuke Themes, PostNuke Themes, Zikula Themes, WordPress Themes, osCommerce Templates, CRE Loaded Templates, osCommerce Themes, CRE Loaded Themes

Copyright © 2002-2008 Shawn McKenzie and Spidean. Content on this site may not be reproduced in any form without prior written consent.

Syndicate our news  | Google Sitemap

Terms of Use  |  Privacy Policy  |  Credits


AutoTheme   Built with AutoTheme   Enhanced by AutoTheme   Powered by AutoTheme

Valid HTML 4.01!   Valid CSS!
Powered by the AutoTheme HTML Theme System
Page created in 0.108952 Seconds