Is there a Wiki? Create extra pages?
I need to know how to add extra pages, other than what you can do in the admin panel. I need to create extra pages that require access to the database to display certain information (I need to add my own .php pages).
I found this: http://labs.buyscripts.in/projects/vsha ... HP_scripts
...but that code is not working. The page I created is not displaying the header,footer, etc and the database information I am referencing is not displaying on the page.
Re: Is there a Wiki? Create extra pages?
You only need to include config.php, remote the functions.php line, it will work.
Re: Is there a Wiki? Create extra pages?
Oh, yeah, I figured that out...but now for my next problem.
I get a page, but there's no header, footer, etc and the database information I am trying to access is not displayed.
the code here for v2.6
viewtopic.php?f=8&t=1155
does not work for 2.7...at least I haven't figured it out yet.
Fatal error: Class 'STemplate' not found in /home/-----/public_html/---------/vshare27/xxxxx.php on line 10
Line 10 is this: STemplate::assign('err',$err);
Re: Is there a Wiki? Create extra pages?
Refer the code for show_page.php
Re: Is there a Wiki? Create extra pages?
oh duh. I was looking thru the files for an example and didn't even think to look at that one. Thanks. :oops:
Re: Is there a Wiki? Create extra pages?
Here's what I have:
mypage.php is in my vshare root. mypage.tpl is in my templates folder with the rest of them.
Code:
<?php
/******************************************************************************
*
* COMPANY: BuyScripts.in
* PROJECT: vShare Youtube Clone
* VERSION: 2.7
* LISENSE: http://buyscripts.in/vshare-license.html
* WEBSITE: http://buyscripts.in/youtube_clone.html
*
* This program is a commercial software and any kind of using it must agree
* to vShare license.
*
******************************************************************************/
require './include/config.php';
$sql = "SELECT * FROM `pages` WHERE
`page_name`='" . mysql_clean($_GET['name']) . "'";
$result = mysql_query($sql) or mysql_die($sql);
if (mysql_num_rows($result) != 1)
{
show_page_not_found();
}
$page_info = mysql_fetch_assoc($result);
if ($page_info['page_members_only'] == 1)
{
User::is_logged_in();
}
function show_page_not_found()
{
header("HTTP/1.0 404 Not Found");
echo "<html><head><title>Page Not Found</title></head><body>Page Not Found</body></html>";
exit(0);
}
$smarty->assign('err', $err);
$smarty->assign('html_title', $page_info['page_title']);
$smarty->assign('content', $page_info['page_content']);
$smarty->assign('html_description', $page_info['page_description']);
$smarty->assign('html_keywords', $page_info['page_keywords']);
$smarty->display('./templates/header.tpl');
$smarty->display('./templates/mypage.tpl');
$smarty->display('./templates/footer.tpl');
db_close();
In mypage.tpl I have my php code wrapped around the {php} and {/php} tags and nothing else on the page other than my php script. I keep getting "Page not Found" error. Not sure where I'm going wrong.....
Re: Is there a Wiki? Create extra pages?
I even tried inserting the php code directly into mypage.php instead of using the mypage.tpl but I'm still getting "page not found"...I tried different paths to the header and footer, but I get "page not found" on anything I try.
Re: Is there a Wiki? Create extra pages?
Replace
Code:
$smarty->display('./templates/header.tpl');
$smarty->display('./templates/mypage.tpl');
$smarty->display('./templates/footer.tpl');
With
Code:
$smarty->display('header.tpl');
$smarty->display('mypage.tpl');
$smarty->display('footer.tpl');
Don't have to specify templates folder, that is default smarty tpl folder.
Re: Is there a Wiki? Create extra pages?
That's the first thing I tried...which is why I tried other paths...No joy....
page not found.
Re: Is there a Wiki? Create extra pages?
could it be something I need to add to htaccess?
Re: Is there a Wiki? Create extra pages?
What is the url where you get 404 error ?
Re: Is there a Wiki? Create extra pages?
w00t I figured it out...it was the call to the sql query for the page that was screwing it up.
This is what worked:
Code:
require './include/config.php';
if ($page_info['page_members_only'] == 1)
{
User::is_logged_in();
}
function show_page_not_found()
{
header("HTTP/1.0 404 Not Found");
echo "<html><head><title>Page Not Found</title></head><body>Page Not Found</body></html>";
exit(0);
}
$smarty->assign('err', $err);
$smarty->display('header.tpl');
$smarty->display('mypage.tpl');
$smarty->display('footer.tpl');
db_close();
Re: Is there a Wiki? Create extra pages?
There must be another way of doing this...I need some pages to be members only and some open to the public. Anytime I have the sql call in the beginning, I get "page not found"
If I have this, then the page is viewable by everyone. Another problem is that my php code on those special pages require information from the database and that information is not displaying.
Code:
require './include/config.php';
if ($page_info['page_members_only'] == 1)
{
User::is_logged_in();
}
function show_page_not_found()
{
header("HTTP/1.0 404 Not Found");
echo "<html><head><title>Page Not Found</title></head><body>Page Not Found</body></html>";
exit(0);
}
Re: Is there a Wiki? Create extra pages?
in vshare2.6, we used to do somethin glike this and it would work, but doesn't with 2.7---the information from the database is not displayed in 2.7 and I'm using the same database script as I did with 2.6, other than changing the name of the database tables for 2.7 and using the new "include" codes posted earlier.
Code:
<?php
session_start();
require("include/config.php");
require("include/function.php");
if (!isset($_SESSION['USERNAME'])) {
Header("Location: {$config['baseurl']}/login.php");
exit(0);
}
STemplate::assign('err',$err);
STemplate::assign('msg',$msg);
STemplate::display('../templates/header.tpl');
STemplate::display('../templates/error.tpl');
==MY WHOLE BUNCH OF PHP CODE INCLUDING DATABASE QUERIES BLAH BLAH BLAH===
STemplate::display('../templates/footer.tpl');
db_close(); ?>
Re: Is there a Wiki? Create extra pages?
This is what I have in my mypage.php and it's not displaying the database information and I'm using the identical script that I was using in 2.6 (only change is the names of the tables). The page displays, the header and footer is all there..but the content is blank...no information is being shown from the database. The header for the <table> and the <td> cells show up, so I know all that's working but the information that's supposed to be in it is not there and I'm not getting a database error...I just can't figure out why the information won't display and how to get it for member only.
Code:
<?php
session_start();
require("include/config.php");
if (!isset($_SESSION['USERNAME'])) {
Header("Location: {$config['baseurl']}/login.php");
exit(0);
}
$smarty->assign('err',$err);
$smarty->assign('msg',$msg);
$smarty->display('header.tpl');
$smarty->display('error.tpl');
===============MY PHP SCRIPT HERE WHERE IT SHOULD DISPLAY DATABASE INFORMATION================
$smarty->display('footer.tpl');
db_close();
Re: Is there a Wiki? Create extra pages?
Here's what I got so far....the code I just posted above DOES work to make it member only...it's just not displaying the information from the database.