Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Access helper functions from the root directory of Limesurvey

Access helper functions from the root directory of Limesurvey 11 Monate 2 Wochen her #102389

  • utsi
  • utsis Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 25
  • Dank erhalten: 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
Letzte Änderung: 11 Monate 2 Wochen her von utsi.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Access helper functions from the root directory of Limesurvey 11 Monate 2 Wochen her #102396

  • utsi
  • utsis Avatar
  • OFFLINE
  • Junior Lime
  • Beiträge: 25
  • Dank erhalten: 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 :(
Letzte Änderung: 11 Monate 2 Wochen her von utsi.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Access helper functions from the root directory of Limesurvey 11 Monate 2 Wochen her #102469

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6551
  • Dank erhalten: 869
  • Karma: 257
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
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.383 Sekunden
Donation Image