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
PET
Smarty Rookie


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

PostPosted: Wed Feb 28, 2007 6:21 pm    Post subject: Reply with quote

Thanks for the help. I have decided to play with a simple page at the begnining my new question is:

Do I have to keep the template files in the Smarty directory or I can put the templates simply in my directory from htdocs. I tryed to specify the patch like this:

Code:
      $this->template_dir = 'c:/XAMPP/xampp/Smarty/test/templates/';
      $this->compile_dir = 'c:/XAMPP/xampp/Smarty/test/templates_c/';
      $this->config_dir = 'c:/XAMPP/xampp/Smarty/test/configs/';
      $this->cache_dir = 'c:/XAMPP/xampp/Smarty/test/cache/';


If I let it like this it works bechose he finds in the smarty/test all the directories, but if I change the code to this :

Code:
      $this->template_dir = 'c:/XAMPP/xampp/htdocs/test/templates/';
      $this->compile_dir = 'c:/XAMPP/xampp/htdocs/test/templates_c/';
      $this->config_dir = 'c:/XAMPP/xampp/htdocs/test/configs/';
      $this->cache_dir = 'c:/XAMPP/xampp/htdocs/test/cache/';


I get this:
Warning: Smarty error: unable to read resource: "index.tpl" in C:\XAMPP\xampp\Smarty\libs\Smarty.class.php on line 1095

Warning: Smarty error: unable to read resource: "index.tpl" in C:\XAMPP\xampp\Smarty\libs\Smarty.class.php on line 1095

I simply don't like to have files scattered around the HDD Smile Like PHP files in htdocs, template files in smarty directory, etc.

Later Edit:
Sorry for flooding the forum but I fixed it:

Code:
define ("SMARTY_DIR", "C:/XAMPP/xampp/smarty/");


Added this in the setup.php file. Now I can have my templates file in my htdocs dir.
Back to top
View user's profile Send private message Send e-mail
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Mon Jun 08, 2009 5:08 pm    Post subject: Fix the link please Reply with quote

As we have moved into Smarty's own website, the hosted link here in the top of the forum does NOT exist anymore.

You should think of relinking it to a different url.
Back to top
View user's profile Send private message Visit poster's website
neotruth
Smarty Rookie


Joined: 02 Dec 2009
Posts: 7

PostPosted: Thu Jan 07, 2010 8:36 pm    Post subject: Reply with quote

http://www.smarty.net/sampleapp/sampleapp_p1.php


There you go Smile
Back to top
View user's profile Send private message
azizi47
Smarty n00b


Joined: 17 Apr 2010
Posts: 2

PostPosted: Sat Apr 17, 2010 7:47 pm    Post subject: Reply with quote

I am using Google Chrome Browser
_________________
A question that sometimes drives me hazy: am I or are the others crazy?
Albert Einstein

Hotels & Travels | Currency Rates | Watch Movies
Back to top
View user's profile Send private message Visit poster's website
azizi47
Smarty n00b


Joined: 17 Apr 2010
Posts: 2

PostPosted: Sat Apr 17, 2010 7:51 pm    Post subject: Reply with quote

I use Google Chrome onlyy,,,, it's very fast and css works perfect on it.
_________________
A question that sometimes drives me hazy: am I or are the others crazy?
Albert Einstein

Hotels & Travels | Currency Rates | Watch Movies
Back to top
View user's profile Send private message Visit poster's website
MicMonen
Smarty Rookie


Joined: 08 Aug 2010
Posts: 5

PostPosted: Sun Aug 08, 2010 12:54 pm    Post subject: Reply with quote

I am using Google Chrome Browser too
Back to top
View user's profile Send private message
radick
Smarty n00b


Joined: 12 Aug 2010
Posts: 1

PostPosted: Thu Aug 12, 2010 6:54 am    Post subject: General Reply with quote

i'd love to see more to see how people have used it (from an overall architecture perspective as well as at a lower level)... i think people should be encouraged to post apps and source code where possible... i can't at the moment however as i have signed an nda! i will with my next app tho!
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Thu Aug 12, 2010 1:37 pm    Post subject: Reply with quote

I use TinyMVC with Smarty, but I wrote that Very Happy When Smarty 3.0 is released, Smarty will have a new website based on that combination. It is currently spitting out pages in 5/1000ths of a second.
Back to top
View user's profile Send private message Visit poster's website
tamouse
Smarty n00b


Joined: 20 Aug 2010
Posts: 4

PostPosted: Fri Aug 20, 2010 8:36 am    Post subject: Reply with quote

kills wrote:
Hi

iwlucas wrote:
Well, ok.. but if my application have access levels and a page, when accessed by an admin, need to have one button (if u access with another access level this button shouldtn appear)....
Whats is the best way? Make 2 pages, one for admin and another for other users or just put a {if $user eq 'admin'} in the template?? Because that is bussiness logic, isnt?
I dont know if this is the right place for this question, but i want to understand this separation of logic and presentation...
Thx


In my opinion, you will need a smarty function for that.

{ if isAdmin() }
{/if}

Bye,
Markus


or, you can set a variable in the application logic and check it in template:

Code:

{if $is_admin }
{/if}
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
kapaev
Smarty n00b


Joined: 19 Dec 2010
Posts: 1

PostPosted: Sun Dec 19, 2010 11:47 pm    Post subject: Reply with quote

mohrt wrote:
I use TinyMVC with Smarty, but I wrote that Very Happy When Smarty 3.0 is released, Smarty will have a new website based on that combination. It is currently spitting out pages in 5/1000ths of a second.


Laughing
Back to top
View user's profile Send private message Visit poster's website
autoliv
Smarty n00b


Joined: 17 Jan 2011
Posts: 1
Location: Moskow

PostPosted: Mon Jan 17, 2011 5:18 pm    Post subject: Reply with quote

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 Visit poster's website
TheEditor
Smarty Rookie


Joined: 22 Nov 2011
Posts: 12

PostPosted: Tue Nov 22, 2011 2:41 am    Post subject: can't get the sample app to work Reply with quote

The app description on

http://www.smarty.net/sampleapp1

says that "/web/www.example.com/docs/guestbook/index.php will be the entry point of our application."

But the zip file does not contain a /docs/guestbook/index.php file. The app's main file appears to be /docs/index.php.

Which is right - the zip file or the description on the tutorial page?

And its not at all clear from that page precisely where the Smarty files should go.
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Tue Nov 22, 2011 2:59 pm    Post subject: Re: can't get the sample app to work Reply with quote

TheEditor wrote:
The app description on

http://www.smarty.net/sampleapp1

says that "/web/www.example.com/docs/guestbook/index.php will be the entry point of our application."

But the zip file does not contain a /docs/guestbook/index.php file. The app's main file appears to be /docs/index.php.

Which is right - the zip file or the description on the tutorial page?

And its not at all clear from that page precisely where the Smarty files should go.


The index.php is the one you want, and it can really go anywhere under the html docroot, just make sure the file paths are correct. All the other files should be clearly indicated on that page where they go (or you can put them where you want, again check filepaths.)

I'll update the filepath for index.php to not include the /guestbook/ subdir, since that isn't what the zip file has.

[edit] actually the zip contents isn't exactly like the example, you just need to set your path definitions at the top of the index.php file to where the library files are. This is pretty basic PHP filepath stuff.

So:

1) install the index.php file anywhere under doc root
2) install the rest of the php files wherever you want (even under doc root if you prefer)
3) edit index.php and set the filepaths to correspond where you installed the other php files.
Back to top
View user's profile Send private message Visit poster's website
TheEditor
Smarty Rookie


Joined: 22 Nov 2011
Posts: 12

PostPosted: Tue Nov 22, 2011 5:35 pm    Post subject: Reply with quote

Also, guestbook.lib.php pops an error on line 137 telling me that $rows does not exist. I think this is because the table is empty. I inserted a record via phpMyAdmin and do not get that error any longer.
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Tue Nov 22, 2011 5:43 pm    Post subject: Reply with quote

TheEditor wrote:
Also, guestbook.lib.php pops an error on line 137 telling me that $rows does not exist. I think this is because the table is empty. I inserted a record via phpMyAdmin and do not get that error any longer.


Yes. If you want to test if any rows exist, you can easily add that yourself. This is just an example.
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 3 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