Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty Sample Application
Goto page Previous  1, 2, 3, 4, 5  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
matteoraggi
Smarty Rookie


Joined: 02 Jan 2006
Posts: 11
Location: Italy - Forlė - Vecchiazzano

PostPosted: Mon Jan 02, 2006 8:43 am    Post subject: error setup Reply with quote

On your page,
http://smarty.php.net/sampleapp/sampleapp_p1.php
I click to see the demo(using firefox):
http://www.phpinsider.com/php/code/guestbook/

but I see this error:

Warning: main(DB.php): failed to open stream: No such file or directory in /var/www/www.phpinsider.com/docs/php/code/guestbook/libs/guestbook_setup.php on line 14

Warning: main(DB.php): failed to open stream: No such file or directory in /var/www/www.phpinsider.com/docs/php/code/guestbook/libs/guestbook_setup.php on line 14

Fatal error: main(): Failed opening required 'DB.php' (include_path='.:/export/httpd/php/include') in /var/www/www.phpinsider.com/docs/php/code/guestbook/libs/guestbook_setup.php on line 14
_________________
http://www.hotelsupplies.us/
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Tue Jan 03, 2006 2:30 pm    Post subject: Reply with quote

fixed, thanks
Back to top
View user's profile Send private message Visit poster's website
chros
Smarty Regular


Joined: 03 Mar 2006
Posts: 58

PostPosted: Thu Mar 09, 2006 10:35 pm    Post subject: Reply with quote

gestionti wrote:
I am trying to use your Guestbook on my machine. I get the following error :

Call to undefined function: query() in /var/www/html/Guestbook/libs/sql.lib.php on line 69, which is this line :

$this->result = $this->db->query($query);

I have experienced the same error:
MySQL 4.1.18 Windows service
WinXP
PHP 4.3.11

The problem is the instance doesn't created until the connection was made.
It would be helpful to add to guestbook_setup.php :
Code:
...
$this->connect($dsn) or die("Can't connect to the database!");
...


mysql log says:
"Client does not support authentication protocol requested by server; consider upgrading MySQL client"

I haven't found the solution yet ... Sad
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Thu Mar 09, 2006 10:50 pm    Post subject: Reply with quote

the sample and .tar.gz file have been updated, thanks.
Back to top
View user's profile Send private message Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Mar 10, 2006 1:05 am    Post subject: Reply with quote

@chros: http://dev.mysql.com/doc/refman/5.0/en/old-client.html (and/or google that error message for more info)
Back to top
View user's profile Send private message
chros
Smarty Regular


Joined: 03 Mar 2006
Posts: 58

PostPosted: Fri Mar 10, 2006 8:41 am    Post subject: Reply with quote

mohrt wrote:
the sample and .tar.gz file have been updated, thanks.

Are you sure it's updated ?
All the files are 2005.03.14 dated...
url: http://smarty.php.net/sampleapp/sampleapp_p1.php

edit: Ahh, I see that there's the updated guestbook_setup.php on the webpage, but not in the tar.gz file.
Question: Is your update solve my problem, or should I do like what boots said ?

Edit2: thanks boots, I didn't know that. That did the trick Smile
Code:
SET PASSWORD FOR 'dbuser'@'localhost' = OLD_PASSWORD('userpasswd');
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Mar 10, 2006 2:48 pm    Post subject: Reply with quote

The tarfile is updated too. I didn't address your mysql client problem, I just added the error when the DB connection fails.
Back to top
View user's profile Send private message Visit poster's website
Ascendant
Smarty Rookie


Joined: 10 Apr 2006
Posts: 8
Location: Netherlands

PostPosted: Sun Apr 16, 2006 8:45 pm    Post subject: Reply with quote

Generally lessons work better when you start with a stated objective.

I suspect you are intending people to be going to the 'working' demo, but it is not always there.

Actually, as I am reading, my personal preference would be for an image of the HTML to be created rather than having to go to a demo.

Having to read thru lots of detail, and trying to figure out what it means without having an reference to what I am achieving makes the learning curve longer.

Personally, I have had more help from the manual.

What would be helping me more is some lessons on the syntax. I am learning the spaces are taboo.

Basically, more simple things that identify the "moving" parts in foreach and section would work great for me. And as I get there in my understanding, I'll try to make some examples.

But first, I'll probably come with some questions (elsewhere).

Michael
Back to top
View user's profile Send private message
Bart
Smarty Rookie


Joined: 11 Jul 2006
Posts: 6

PostPosted: Sat Jul 15, 2006 5:27 pm    Post subject: Reply with quote

Hi guys,

I've used the main db class from the guestbook example in my new project...

it looks like this (see below):

NOW my problem is that I have come to a point where I want to use numRows() are affectedRows() to find out how many rows were affected by the last update...

.. I cant find out how to do this and the main problem is: i dont find any documentation about the SQL class I am extending... I mean ok it is pear db and the DB class is documented, but well..

My Questions:
1) Could you give me a quick hint how to do a num rows?
2) Where do I find a documentation about the SQL class of the Pear package we are using??

Cheers for the tipps
Bart

Here is the code:

<?php
// database configuration
class CustomSQL extends SQL {
function CustomSQL() {
// Superconstructor aufrufen
parent::__construct();
// Config vornehmen
$dsn = "mysql://".DB_USER.":".DB_PASSWORD."@".DB_HOST."/".DB_database;
$this->connect($dsn) || die('could not connect to database');
}
}
?>
Back to top
View user's profile Send private message
mindfriction
Smarty n00b


Joined: 11 Jan 2006
Posts: 4

PostPosted: Tue Aug 08, 2006 12:00 am    Post subject: Reply with quote

Hi Bart,

essentially the SQL class (sql.lib.php) in the sample app is just a wrapper class for Pear DB, so you should be able to look up the nuwRows() documentation on the Pear website and create the relative wrapper function.
Back to top
View user's profile Send private message
danfreak
Smarty Rookie


Joined: 23 Sep 2006
Posts: 10
Location: Italy

PostPosted: Sat Sep 23, 2006 9:58 pm    Post subject: Reply with quote

hey Monte (mohrt),

first of all cheers for the great and usefull application you developed!

Great job man!

I've taken your sample application as a start fro a new application I'm developing using smarty.

I builded a submenu, whose php file structure is based on the guestbook.lib.php (Class Guestbook).

I used an {insert} fuction to insert the menu in my main template.

Given that {insert} works only with functions, how is it possible to access the methods of a class using {insert}?

Could you please provide an example?

Cheers!

Wink

PS: I found this post in the forum ({insert}-php-function should be a "true" callback), but an example in the sample application on how to make it work could be usefull!
Back to top
View user's profile Send private message Visit poster's website
sanp
Smarty n00b


Joined: 24 Oct 2006
Posts: 1

PostPosted: Tue Oct 24, 2006 10:59 am    Post subject: Reply with quote

whre can i get the DB.php?
i'm poor in php Embarassed thanks
Back to top
View user's profile Send private message
danfreak
Smarty Rookie


Joined: 23 Sep 2006
Posts: 10
Location: Italy

PostPosted: Tue Oct 24, 2006 11:20 am    Post subject: Reply with quote

Have a look here: http://pear.php.net/package/DB
Back to top
View user's profile Send private message Visit poster's website
PET
Smarty Rookie


Joined: 28 Feb 2007
Posts: 11
Location: Timisoara/Romania

PostPosted: Wed Feb 28, 2007 12:50 am    Post subject: Reply with quote

Hello, please exchuse my n00bish, but...

I have installed smarty and tested a small script, so Smarty works. Then I have tested the Guestbook.

I simply copyed the directory (guestbook) from the archive to my "htdocs" folder, then run it trought the browser. Ofcourse, i got errors (pretty logic but I usualy do this then I configure the script Razz...I like to see errors).

Then I put the patch's like this:

guestbook_setup.php
Code:

require(GUESTBOOK_DIR . 'libs/sql.lib.php');
require(GUESTBOOK_DIR . 'libs/guestbook.lib.php');
require(SMARTY_DIR . 'Smarty.class.php');
require('C:/XAMPP/xampp/php/pear/DB.php'); // PEAR DB


index.php
Code:

// define our application directory
define('GUESTBOOK_DIR', 'C:/XAMPP/xampp/htdocs/guestbook/');
// define smarty lib directory
define('SMARTY_DIR', 'C:/XAMPP/xampp/Smarty/libs/');
// include the setup script
include(GUESTBOOK_DIR . 'libs/guestbook_setup.php');


This is the absolute patch. Did I do something wrong? All I see now when I acces the page is a WHITE PAGE. Should I put the templates files in the smarty dir?


Later Edit:
Since I posted this post. I'm usualy working on localhost on all my projects (pretty logic Razz) so, I create a directory in htdocs for each project. So since now I will start using Smarty, will the projects TEMPLATES file go into the "Smarty" directory? Or I can put the template files in a special templates directory inside projects directory?
Back to top
View user's profile Send private message Send e-mail
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Feb 28, 2007 3:04 pm    Post subject: Reply with quote

If you are getting a blank page, my guess is you have a PHP error, but the error reporting is off. Check your log files, or turn on error reporting.

I'd keep the smarty templates out of the smarty lib directory. See the Installation instructions for examples.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 2 of 5

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP