Bienvenue, Invité
Nom d'utilisateur : Mot de passe : Se souvenir de moi

SUJET : Access helper functions from the root directory of Limesurvey

Access helper functions from the root directory of Limesurvey il y a 10 mois 3 semaines #102389

  • utsi
  • Portrait de utsi
  • Hors ligne
  • Junior Lime
  • Messages : 25
  • Remerciements reçus 1
  • Karma: -2
Hi. I'm looking to access SPSSFieldMap() and createFieldMap() functions contained within the "export_helper.php" and "common_helper.php" files.

The problem I'm facing is I'm not able to figure out how to include them in a file which is placed in the root directory and not inside the "application" folder.

I want to give a URL to someone (let's say it's www.abcd.com/view.php) and in this view.php, I need to access those two functions. I do have Limesurvey installed on www.abcd.com and need a way to be able to access those helper functions from view.php.

I hope my post made sense. Let me know if something in unclear.

Thanks.

EDIT:
My directory structure is something like this:
abcde/
  application/
     controllers/
         AllController.php
     views/
         all/
            view_view.php
  framework/
  .
  .

AllController.php
class AllController extends CController 
{
    public function actionIndex()
    {
	$aData = 'why';
	$this->render('all/view', $aData);
    }
}

view_view.php
echo $aData; // getting undefined variable on running this page
Dernière édition: il y a 10 mois 3 semaines par utsi.
L'administrateur a désactivé l'accès en écriture pour le public.

Access helper functions from the root directory of Limesurvey il y a 10 mois 3 semaines #102396

  • utsi
  • Portrait de utsi
  • Hors ligne
  • Junior Lime
  • Messages : 25
  • Remerciements reçus 1
  • Karma: -2
I did figure out the solution to a part of the problem; i.e. undefined variable issue . I was passing and accessing the data in a wrong way. The correct way was:

Passing Data
public function actionIndex()
{
   $aData['var1'] = 'Value 1';
   $this->render('all/view', $aData);
}

Reading Data
echo $var1; // prints Value 1

Accessing the helper functions is still a mystery to me at the moment :(
Dernière édition: il y a 10 mois 3 semaines par utsi.
L'administrateur a désactivé l'accès en écriture pour le public.

Access helper functions from the root directory of Limesurvey il y a 10 mois 2 semaines #102469

  • DenisChenu
  • Portrait de DenisChenu
  • Hors ligne
  • Moderator Lime
  • Messages : 6471
  • Remerciements reçus 853
  • Karma: 254
Hi,

You can add your own controllers in application/controllers directory.
After if you set your ocntrollers name to TestController, you can acces it with url
example.org/test , or example.org/index.php?r=test (i think for the second way, didn't test).

In your controller, you can use Yii->app(), and the call your helper.

Denis
L'administrateur a désactivé l'accès en écriture pour le public.
Modérateurs: ITEd
Temps de génération de la page : 0.384 secondes
Donation Image