Jump to content

PHP Smarty


JustinK101

Recommended Posts

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


Link to comment
Share on other sites

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?
[code]
echo get_include_path();
[/code]
Link to comment
Share on other sites

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--]
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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--]
Link to comment
Share on other sites

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).
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.