Closed Lithl closed 10 years ago
Sounds like the module isn't enabled in the bootstrap?
Unfortunately, it is (I did double-check). My server hosts my SVN respository in addition to my website, and I have a post-commit hook to update my staging site whenever there's a new revision. Thus, assuming I don't have uncommitted changes, my staging site and my local copy are always identical codebases.
My post-commit hook is, essentially:
# Always update staging
svn update /var/www/staging --accept theirs-full
# Check if the commit was a tagged version
SVNLOOK=$(svnlook history -r $REV $REPOS /tags | grep $REV)
if [ -n $SVNLOOK ]; then
# Get the tag name
TAG=$(svn ls file://$REPOS@$REV ^/tags | tail -1)
# Move production to the new version
svn switch file://$REPOS/tags/$TAG /var/www/production
fi
There is no difference between /var/www/staging/application/bootstrap.php
and E:\Projects\cmdr-class\application\bootstrap.php
; both have Smarty enabled as a module, but only one of the two works.
Kohana is not finding the Kohana-Smarty module at all. I can only think of the following:
echo
in the one you think it is loading to check?In application/bootstrap.php:
Kohana::modules(array(
'auth' => MODPATH.'auth',
'database' => MODPATH.'database',
'orm' => MODPATH.'orm',
'smarty' => MODPATH.'smarty'
));
Added:
echo MODPATH.'smarty';
Result:
/var/www/staging/modules/smarty
(This exists, and is where my Smarty module is located)
/var/www and all files and directories under it have drwxr-xr-x
or -rw-r--r--
permissions, owned by user www-data
and group root
. Apache/PHP runs my scripts as www-data
.
Weird stuff.
Only thing I can think about is, since you're talking about staging, your svn hook says move to production. Could that be something?
svn switch file://$REPOS/tags/$TAG /var/www/production
When I commit a revision, staging (which is a svn working directory) updates to the head revision of the trunk (the one just committed). when I tag a revision, production (also a svn working directory) switches from whatever it's currently pointing to, to the tagged version.
Do the other modules you have enabled work? Can you use an ordinary PHP page template in your controller to try things out?
I assume you are using the master
branch, I have just noticed a problem there with duplicate directory names due to some combination of Windows and Linux machines generating and applying pull requests and running tests. I will fix this.
Just tested my three controllers that I use for AJAX requests; one requests data from a third party via curl
, and the other two query my database using the orm
module (and thus indirectly using the database
module). All function correctly, although I don't currently have a controller without a view with which to test auth
.
On the flip side, testing those three controllers made me realize that I hadn't actually installed curl on my server, let me find a bug in my SQL connection configuration for PHP, and let me find a logic error in one of my queries. :)
I think the problem is caused by case sensitive file names (e.g. View.php and view.php). Try deleting view.php and the classes/controller, classes/kohana and classes/smarty directories on the linux box for a quick fix.
I need to revisit the pull request converting to Kohana 3.3 compatibility: it may take 48 hours to test properly and sort GitHub.
@MrAnchovy , if you will accept pull to converting to Kohana 3.3 compatibility, please leave some branch for 3.2 users, like 3.2/master, with lowercase file names.
@MrAnchovy Huzzah! I capitalized the following filenames, and now it works:
MODPATH/smarty/classes/view.php
-> View.php
MODPATH/smarty/classes/Smarty/view.php
-> View.php
MODPATH/smarty/classes/Smarty/helper.php
-> Helper.php
MODPATH/smarty/classes/Kohana/Smarty/helper.php
-> Helper.php
Only the two view.php
files and the two helper.php
files needed changing. The changes do not negatively affect my Windows local copy.
@Lithl thanks, I will update GitHub later.
@seyfer the V1 branch will remain as the version to use for Kohana 3.0-3.2. I will put a link to this in the README in master
.
@MrAnchovy , you can accept this pull https://github.com/MrAnchovy/Kohana_Smarty3/pull/19 but please, make smarty via composer in https://github.com/MrAnchovy/Kohana_Smarty3/tree/V1 branch too. thank you.
On my localhost (Windows), I have this module working fine. On my server (Debian), Kohana can't find my template files. (Both server and local have the same file versions, and server has correct permissions on all files.) This applies to all of my controllers which display a view (with the appropriate template file substituted, of course).
Kohana is dying at
SYSPATH/classes/Kohana/View.php
whenKohana::find_file('views', $file)
fails to find the template. A cursory look overfind_file
suggested to me that it may be trying to look for index.tpl.php instead of index.tpl. I addedecho $path.'<br>';
tofind_file
to confirm my suspicions, and I was correct: on my localhost, one of the lines output isviews\index.tpl
, while on my server, I seeviews/index.tpl.php
.However, I discovered another oddity. Here is the full list of paths Kohana is looking for on each of my server and my local machine:
Notice the large gap where Kohana should be looking for Smarty module classes. Any ideas?