View previous topic :: View next topic |
Author |
Message |
PET Smarty Rookie
Joined: 28 Feb 2007 Posts: 11 Location: Timisoara/Romania
|
Posted: Wed Feb 28, 2007 6:21 pm Post subject: |
|
|
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 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 |
|
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Mon Jun 08, 2009 5:08 pm Post subject: Fix the link please |
|
|
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 |
|
neotruth Smarty Rookie
Joined: 02 Dec 2009 Posts: 7
|
|
Back to top |
|
azizi47 Smarty n00b
Joined: 17 Apr 2010 Posts: 2
|
Posted: Sat Apr 17, 2010 7:47 pm Post subject: |
|
|
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 |
|
azizi47 Smarty n00b
Joined: 17 Apr 2010 Posts: 2
|
Posted: Sat Apr 17, 2010 7:51 pm Post subject: |
|
|
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 |
|
MicMonen Smarty Rookie
Joined: 08 Aug 2010 Posts: 5
|
Posted: Sun Aug 08, 2010 12:54 pm Post subject: |
|
|
I am using Google Chrome Browser too |
|
Back to top |
|
radick Smarty n00b
Joined: 12 Aug 2010 Posts: 1
|
Posted: Thu Aug 12, 2010 6:54 am Post subject: General |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Aug 12, 2010 1:37 pm Post subject: |
|
|
I use TinyMVC with Smarty, but I wrote that 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 |
|
tamouse Smarty n00b
Joined: 20 Aug 2010 Posts: 4
|
Posted: Fri Aug 20, 2010 8:36 am Post subject: |
|
|
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 |
|
kapaev Smarty n00b
Joined: 19 Dec 2010 Posts: 1
|
Posted: Sun Dec 19, 2010 11:47 pm Post subject: |
|
|
mohrt wrote: | I use TinyMVC with Smarty, but I wrote that 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 |
|
autoliv Smarty n00b
Joined: 17 Jan 2011 Posts: 1 Location: Moskow
|
Posted: Mon Jan 17, 2011 5:18 pm Post subject: |
|
|
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 |
|
TheEditor Smarty Rookie
Joined: 22 Nov 2011 Posts: 12
|
Posted: Tue Nov 22, 2011 2:41 am Post subject: can't get the sample app to work |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Nov 22, 2011 2:59 pm Post subject: Re: can't get the sample app to work |
|
|
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 |
|
TheEditor Smarty Rookie
Joined: 22 Nov 2011 Posts: 12
|
Posted: Tue Nov 22, 2011 5:35 pm Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Nov 22, 2011 5:43 pm Post subject: |
|
|
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 |
|
|