0
votes

I'm trying to add a Javascript file to a Typo3 plugin that a company has built for me.

The file main.js(/public_html/typo3conf/etc/intranetapi/Resources/Public/Javascript/main.js) is now being included. I've been searching through the code and found the following:

public_html/typo3conf/etc/intranetapi/Configuration/TypoScript/contants.txt

plugin.tx_intranetapi {
    settings {
        js {
            # cat=plugin.tx_intranetapi_js/javascript; type=string; label=Javascript file 1
            file1 = EXT:intranetapi/Resources/Public/Javascript/main.js     
        }
    }
}

public_html/typo3conf/etc/intranetapi/Configuration/TypoScript/setup.txt

plugin.tx_intranetapi {
    settings {
        js {
            file1 = {$plugin.intranetapi.settings.js.file1}
        }
    }
}

page.includeJSFooterlibs.intranetapi = {$plugin.tx_intranetapi.settings.js.file1}

The file main.js is included the way it should, but now I'd like to add another javascript file called intranetApi.js.

I thought I could do that this way: public_html/typo3conf/etc/intranetapi/Configuration/TypoScript/contants.txt

plugin.tx_intranetapi {
    settings {
        js {
            # cat=plugin.tx_intranetapi_js/javascript; type=string; label=Javascript file 1
            file1 = EXT:intranetapi/Resources/Public/Javascript/main.js 

            # cat=plugin.tx_intranetapi_js/javascript; type=string; label=Javascript file 2
            file1 = EXT:intranetapi/Resources/Public/Javascript/intranetApi.js      
        }
    }
}

public_html/typo3conf/etc/intranetapi/Configuration/TypoScript/setup.txt

plugin.tx_intranetapi {
    settings {
        js {
            file1 = {$plugin.intranetapi.settings.js.file1}
            file2 = {$plugin.intranetapi.settings.js.file2}
        }
    }
}

page.includeJSFooterlibs.intranetapi = {$plugin.tx_intranetapi.settings.js.file1}
page.includeJSFooterlibs.intranetapi = {$plugin.tx_intranetapi.settings.js.file2}

After the code changes above, I cleared all Typo3 cache by clicking on the lightening icon at the top of the page. But unfortunatly it isin't working.

I personally think it has something to do with page.includeJSFooterlibs.intranetapi = {$plugin.tx_intranetapi.settings.js.file2} where I'm overwriting the old config I think. I also tried page.includeJSFooterlibs.intranetapi = {$plugin.tx_intranetapi.settings.js.file1, $plugin.tx_intranetapi.settings.js.file2} but that doesn't work either...

I'm quite new to Typo3 and I can't find any other information about this sort of problems. Help would be appreciated!

1

1 Answers

1
votes

In public_html/typo3conf/etc/intranetapi/Configuration/TypoScript/contants.txt you have file1 two times, this overrides the first javascript file (main.js).

For the second file you can use another name in the TypoScript setup, so instead intranetapi two times, intranetapi and (eg) intranetapi2.