This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Does snipeet works on sf 1.0 ?

Social code snippet repository

Does snipeet works on sf 1.0 ?

by j0k3r » Wed Apr 04, 2007 2:50 pm

Hello :)~ :-)~ :smile:

I try to install snipeet (using the nice one tuto from NiKo) but i got thoses nice errors :
Code: Select all
Warning: include(symfony/pear.php) [function.include]: failed to open stream: No such file or directory in /var/www/snippets/apps/snippets/config/config.php on line 14

Warning: include() [function.include]: Failed opening 'symfony/pear.php' for inclusion (include_path='.:/usr/share/php') in /var/www/snippets/apps/snippets/config/config.php on line 14

Fatal error: Uncaught exception 'Exception' with message 'Unable to find symfony librairies' in /var/www/snippets/apps/snippets/config/config.php:16 Stack trace: #0 /var/www/snippets/web/frontend_dev.php(8): require_once() #1 {main} thrown in /var/www/snippets/apps/snippets/config/config.php on line 16


And i read here symfony/pear.php file does not exist anymore in new version.
So : does snipeet works on symfony 1.x ?

Thanks for your answer :)~ :-)~ :smile:
j0k3r
Member
 
Posts: 46
Joined: Wed Dec 13, 2006 7:15 pm
Location: France - Paris

Re: Does snipeet works on sf 1.0 ?

by j0k3r » Tue May 22, 2007 5:10 pm

Ok, snipeet doesn't works on sf 1.0.

I made some modification that you can see below.

First we have to modify the file /SYMFONY. It is empty by default. Put this into :
Code: Select all
#!/usr/bin/env php
<?php

/*
 * This file is part of the symfony package.
 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

chdir(dirname(__FILE__));
include('config/config.php');
include($sf_symfony_data_dir.'/bin/symfony.php');


Then, /apps/snippets/config/config.php was completely out of date. Replace all the contents by this one :
Code: Select all
<?php

// include project configuration
include(SF_ROOT_DIR.DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'config.php');

// symfony bootstraping
require_once($sf_symfony_lib_dir.'/util/sfCore.class.php');
sfCore::bootstrap($sf_symfony_lib_dir, $sf_symfony_data_dir);


Add those lines to the /apps/snippets/config/filters.yml file :
Code: Select all
rendering: ~
web_debug: ~
security:  ~

# generally, you will want to insert your own filters here

cache:     ~
common:    ~
flash:     ~
execution: ~


In those file /apps/snippets/modules/comment/templates/_comment.php, /apps/snippets/modules/snippet/templates/editSuccess.php and /apps/snippets/modules/snippet/templates/listSuccess.php, you juste have to change use_helpers to use_helper.

In file /apps/snippets/modules/user/templates/createSuccess.php add this line at the top :
Code: Select all
<?php use_helper('Validation') ?>


Edit /config/config.php to add those line. Those path depends of your environment:
Code: Select all
<?php

// symfony directories
$sf_symfony_lib_dir  = 'C:\Program Files\EasyPHP1-7\php\pear/symfony';
$sf_symfony_data_dir = 'C:\Program Files\EasyPHP1-7\php\pear\data/symfony';


In /lib/model/SnippetCommentPeer.php, replace :
Code: Select all
public function getLatests($max)

by
Code: Select all
public static function getLatests($max)


And to finish, in /lib/model/SnippetTagPeer.php replace this
Code: Select all
public function getPopular($levels = 3, $floor = 0.2, $power = 0.4)

to
Code: Select all
public static function getPopular($levels = 3, $floor = 0.2, $power = 0.4)

and this
Code: Select all
$max_count = max($all_tags);

to
Code: Select all
$max_count = (count($all_tags)) ? max($all_tags) : 0;


That's all !
I hope a help some people who wanted to play with snipeet under sf 1.0 :D~ :-D~ :grin:
j0k3r
Member
 
Posts: 46
Joined: Wed Dec 13, 2006 7:15 pm
Location: France - Paris

Re: Does snipeet works on sf 1.0 ?

by imagize » Tue Nov 27, 2007 11:48 am

I wish I saw this post about 20 mins ago. I just went through and found all those changes myself :lol:

Some more changes I found

in apps/snippets/modules/snippet/templates/editSuccess.php change

Code: Select all
<?php echo use_helpers('Object', 'Javascript') ?>


to

Code: Select all
<?php echo use_helper('Object', 'Javascript', 'Validation') ?>
imagize
Junior Member
 
Posts: 9
Joined: Tue Nov 27, 2007 4:54 am