Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add classes (e.g. lib) to a given Typo3 extension?
    primarykey
    data
    text
    <p>I got a (imho) minor noob question concerning writing of Typo3 Extensions (ver. 4.5 LTS). What I try is simply make up a little MVC class pattern which contains a small curl statement to retrieve information from a remote location. In principle, the MVC classes are already implemented and I just want to include them into the main procedure of my plugin extension. That was what I guessed to work:</p> <pre><code>class tx_uniklstudgangext2013_pi1 extends tslib_pibase { public $prefixId = 'tx_uniklstudgangext2013_pi1'; // Same as class name public $scriptRelPath = 'pi1/class.tx_uniklstudgangext2013_pi1.php'; // Path to this script relative to the extension dir. public $extKey = 'uniklstudgangext2013'; // The extension key. public $pi_checkCHash = TRUE; /** * The main method of the Plugin. * * @param string $content The Plugin content * @param array $conf The Plugin configuration * @return string The content that is displayed on the website */ public function main($content, array $conf) { $this-&gt;conf = $conf; $this-&gt;pi_setPiVarDefaults(); $this-&gt;pi_loadLL(); $view = t3lib_div::makeInstance('tx_uniklstudgangext2013_pi1_view'); // !HERE! : also tried with new(), since I don't want to deal with XCLASS here... // this works: $content = "&lt;p&gt;Hello world!&lt;/p&gt;";...the line below doesn't... $content = $view-&gt;getCourseInfoOutput(); /*' &lt;strong&gt;This is a few paragraphs:&lt;/strong&gt;&lt;br /&gt; &lt;p&gt;This is line 1&lt;/p&gt; &lt;p&gt;This is line 2&lt;/p&gt; &lt;h3&gt;This is a form:&lt;/h3&gt; &lt;form action="' . $this-&gt;pi_getPageLink($GLOBALS['TSFE']-&gt;id) . '" method="POST"&gt; &lt;input type="text" name="' . $this-&gt;prefixId . '[input_field]" value="' . htmlspecialchars($this-&gt;piVars['input_field']) . '" /&gt; &lt;input type="submit" name="' . $this-&gt;prefixId . '[submit_button]" value="' . htmlspecialchars($this-&gt;pi_getLL('submit_button_label')) . '" /&gt; &lt;/form&gt; &lt;br /&gt; &lt;p&gt;You can click here to ' . $this-&gt;pi_linkToPage('get to this page again', $GLOBALS['TSFE']-&gt;id) . '&lt;/p&gt; '; */ return $this-&gt;pi_wrapInBaseClass($content); } } </code></pre> <p>I am a beginner in the Typo3 programming and I guess there are a hundred implicit issues I don't have in mind so far (by just not knowing how Typo3 operates implicitly). What I tried/did so far:</p> <ul> <li>Disabling the template-cache globally by setting it up in the root template.</li> <li><p>Conversion of all new statements into makeInstance(); not wanting this hookup to screw all my MVC code, I overwrote the called method $view->getCourseInfoOutput() by</p> <pre><code>public function getCourseInfoOutput() { return "hello world!"; //return $this-&gt;_model-&gt;getTemplateByCourseId(5); } </code></pre></li> <li><p>which leads me to the next issue: It just does not get the hello world within this! It seems, that Typo3 anyhow supresses the return value from classes out of the extension root class</p></li> <li>When I put all the code successively into the main method, it worked out just fine</li> </ul> <p>Could anyone please help me :/ I admit, that there is a slight possibility that I totally misunderstood how extensions work, but, as I said, I just want my code to run within the extension and simply return one single value. Is this really that hard?</p> <p>Greetings &amp; thx in advance! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload