Jump to content


Photo

PHP Smarty


  • Please log in to reply
5 replies to this topic

#1 JustinK101

JustinK101
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego, California, US

Posted 02 June 2006 - 11:55 PM

Hello,

I have been coding in PHP + mySQL for a few years now, but recently a buddy of mine told me about the smarty template engine. My projects at work are starting to get large, and I really need a way to make things easiers, faster, and better. Smarty appears to be the answer.

We use a shared hosting account which provides php4 and mysql 4. It doesnt give me shell access though. I downloaded Smarty, and I don't really know to intall and use it. I tried following the manual but it wanted me to execute shell commands. Is there any way of installing Smarty on a shared hosting account which doesnt have shell access? There must be.

Thanks for any information/tutorials/ or links you can direct my way. Again, I know absolutely 0 about Smarty and I am sure there are others who would like to learn how to use it as well.

-- Justin




#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 03 June 2006 - 01:46 AM

I think Smarty is a PEAR package. Although Im sure you could manually upload it, I suggest asking your hosting company wether or not they have PEAR and Smarty installed. Chances are good that they will.

You could even try and see for yourself. What does this procduce?
echo get_include_path();


#3 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 03 June 2006 - 03:55 AM

Smarty IS NOT a PEAR package. And you don't need shell access to use it. All you have to do is download the library, and copy the contents into your directory.

1. Download the latest version from [a href=\"http://smarty.php.net/download.php\" target=\"_blank\"]http://smarty.php.net/download.php[/a].

2. Copy the contents of the Smarty-2.x.x/libs directory to the folder that you have created in your directory (libs/smarty - just an example).

3. To operate correctly, you will need three folders in your main directory.
- templates
- templates_c
- configs

That is basically what you need to get started. But you will definitely read more on actually using Smarty. 'Beginning PHP 5 and MySQL E-Commerce' is what taught me how to work with Smarty. And I actually think that they are publishing a book about Smarty, if it is not already out.

If you need anymore help, just post and I'll do what I can to help you with it.

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]

#4 JustinK101

JustinK101
  • Members
  • PipPipPip
  • Advanced Member
  • 503 posts
  • LocationSan Diego, California, US

Posted 03 June 2006 - 07:27 AM

jeremywesselman:

When you say download and copy into my directory, do you mean just my root? Because how I have it setup is a have various different PHP/MySQL projects in one hosting accounts, but in their own folders. For example I have a an order management application in folder 'om' and calendar in 'cal' and referral program application in 'referral'. If I just copy the smarty directory into root can I use it everywhere in all my different projects, or do I have to copy smarty into every projects folders and setup every project?

#5 jeremywesselman

jeremywesselman
  • Members
  • PipPipPip
  • Advanced Member
  • 154 posts
  • LocationIndependence, KY

Posted 03 June 2006 - 07:39 AM

I'm sure you can just put it in the root directory and use it in all applications, but I haven't tried that. But with the way that I have mine set up, I put a copy in each project folder, because I bury the template_c and configs folder in the library itself because you never really need to use anything in these folders.

Give it a shot. And if it don't work, you'll have to put a separate library in each app folder.

[!--coloro:#990000--][span style=\"color:#990000\"][!--/coloro--]Jeremy[!--colorc--][/span][!--/colorc--]

#6 Vikas Jayna

Vikas Jayna
  • Members
  • PipPipPip
  • Advanced Member
  • 121 posts
  • LocationNoida, Delhi, India

Posted 03 June 2006 - 08:37 AM

You just need to download the Smarty files and put them in a directory anywhere on the disk, even outside the apache's root directory. There is no need of copying the smarty files in each of the application folders. The applications just need to include the Smarty.class.php (by giving the absolute path of this file).
Vikas Jayna,
Project Manager - Jeevansathi.com
7 yrs. exp. in LAMP
Certified Mysql DBA
Zend Certified Engineer




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users