Probleme avec helper

Par Kamduras, il y a 13 ans


Bonsoir, j’essaie d'utiliser cette Helper : https://github.com/kshakirov/cakephp-lang-helper/blob/master/lang\_helper.php

Mais j'ai un message d'erreur quand je tente de l'utiliser.

Fatal Error
Error: Call to a member function countrySelect() on a non-object

Pourtant je suis bien la doc...

merci d'avance.

6 réponses

Maenhyr, il y a 13 ans

Comment l'utilises tu? As tu bien ajouté le Helper dans le dossier app/Views/Helper ? Si je me base sur les helpers que j'utilise, il faut écrire :

$this->Lang->selectCountry();

Essaye avec ça et dis nous si c'est mieux.

Kamduras, il y a 13 ans

Merci mais j'ai cette nouvelle erreur maintenant.

Fatal Error
Error: Call to a member function input() on a non-object
File: \app\View\Helper\LangHelper.php
Line: 670
Maenhyr, il y a 13 ans

Et si à la place de

class LangHelper extends FormHelper

, tu lui mets

class LangHelper extends AppHelper

?

Kamduras, il y a 13 ans

Aucun changement, je crois que ce helper n'est pas adapté pour la version de CakePhp que j'utilise, la version 2...

Kamduras, il y a 13 ans

Si quelqu'un connait un helper qui pourrait m'aider, je suis preneur ;)

Kamduras, il y a 13 ans

On m'as donné la solution sur un autre forum.

En faite c'est la function __construct qui va pas, il faut changer par

public function __construct(View $View, $settings = array()) {
    parent::__construct($View, $settings); 
    $this->mapper = $this->parseLangHeaders();
    $this->langCode = $this->findLangCode();
    $this->countryCode = $this->findCountryCode();
}

J'ai forker et j'ai fais les modifs nécessaires.

https://github.com/Kamduras/cakephp-lang-helper