So i've got this little plugin named AnnuaireAdherents with a variable that i try to access from within a template :
annuaireadherents/
├── AnnuaireAdherentsPlugin.php
├── services
│ ├── AnnuaireAdherents_Service.php
│ └── Proxy.php
├── twigextensions
│ └── AnnuaireAdherentsTwigExtension.php
└── variables
└── AnnuaireAdherentsVariable.php
The variable should return a dynamic array, but let's try a static one first :
<?php namespace Craft;
/**
* Variables provides access to list of adherents inside templates
*/
class AnnuaireAdherentsVariable {
/**
* Liste d'adhérents
*
* @return array
*/
public function adherents() {
return array(
array(
"raison_sociale" => "JOHN DOE & Co",
"contact" => "JOHN DOE",
"cp" => "99999",
"address1" => "DESTINY STREET",
"locality" => "NOWHERE",
"mail" = "[email protected]"
)
);
}
}
I've tried every namespace variants i could think of to access it inside a template :
{% for adh in craft.annuaireAdherents.adherents %}
{{ adh.raison_sociale }}
{% endfor %}
but i keep receiving the error :
Method "annuaireAdherents" for object "Craft\CraftVariable" does not exist
Is it the correct namespace ? Do i have to relaunch Apache and Craft between each code modification to retest my variable ? Could there be another error that is masking me the true cause of this message ?
Thanks a lot for any clue / direction to investigate.