Typo3 staticpub extension not publishing static files - typo3

I installed staticpub extension,but its not working.
this is my crawler configuration
tx_crawler.crawlerCfg.paramSets.test = &L=[0-5]
tx_crawler.crawlerCfg.paramSets.test {
cHash = 1
procInstrFilter = tx_indexedsearch_reindex, tx_indexedsearch_crawler
}
tx_crawler.crawlerCfg.paramSets {
staticpub = &L=[|_TABLE:pages_language_overlay;_FIELD:sys_language_uid]
staticpub.procInstrFilter = tx_staticpub_publish
}
I updated following lines in localconf.php also i created staticpub directory in root of my website.
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['staticpub']['publishDir'] = '_staticpub_/';
I found not record in tx_staticpub_pages table. Also no file in staticpub directory.

Please don't use that feature! It's silly and useless and has been removed from TYPO3 for the upcoming version 4.6.
Please use e.g. EXT:nc_staticfilecache

Related

How to make an extension configurable through extension manager (TYPO3)

I am currently developing my own TYPO3 extension (in v 9.5.11) and I would like to make some settings of my extension customisable. When I go to Admin Tools-->Settings-->Extension Configuration-->Configure Extensions, I can already change those settings.
However in earlier versions of TYPO3 (e.g. v7) it was possible to also make an extension configurable through Admin Tools-->Extensions-->"clicking the settings wheel of the desired extension" (see picture).
Where do I implement said function?
You simply define your desired settings in the file ext_conf_template.txt which needs to be stored in the root level of your extension.
The official TYPO3 documentation contains detailed instructions.
Like Michael said, you need to put all settings into the ext_conf_template.txt
Here is an example of my extension "slug" wich you can also find on Github or in the TYPO3 repository. It contains some special fields and even translations.
# Settings
###########################
# cat=defaults; type=options[10,20,30,40,50,60,70,80,90,100,150,200,300,400,500]; label=LLL:EXT:slug/Resources/Private/Language/locallang_be.xlf:default.maxentries
defaultMaxEntries = 20
# cat=defaults; type=options[crdate,tstamp,title,slug,sys_language_uid,is_siteroot,doktype]; label=LLL:EXT:slug/Resources/Private/Language/locallang_be.xlf:default.orderby
defaultOrderBy = crdate
# cat=defaults; type=options[DESC,ASC]; label=LLL:EXT:slug/Resources/Private/Language/locallang_be.xlf:default.order
defaultOrder = DESC
# cat=defaults; type=boolean; label=LLL:EXT:slug/Resources/Private/Language/locallang_be.xlf:default.recordInfoEnabled
recordInfoEnabled = 1
# cat=tree; type=boolean; label=LLL:EXT:slug/Resources/Private/Language/locallang_be.xlf:tree.enabled
treeEnabled = 1
# cat=tree; type=options[1,2,3,4,5,6,7,8,9,10]; label=LLL:EXT:slug/Resources/Private/Language/locallang_be.xlf:tree.depth
treeDefaultDepth = 3
# cat=tree; type=string; label=LLL:EXT:slug/Resources/Private/Language/locallang_be.xlf:tree.root
treeDefaultRoot =
# cat=custom records; type=boolean; label=LLL:EXT:slug/Resources/Private/Language/locallang_be.xlf:record.enabled
recordEnabled = 0
# cat=custom records; type=options[10,20,30,40,50,60,70,80,90,100,150,200,300,400,500]; label=LLL:EXT:slug/Resources/Private/Language/locallang_be.xlf:record.maxentries
recordMaxEntries = 10
# cat=custom records; type=options[crdate,title,path_segment,sys_language_uid]; label=LLL:EXT:slug/Resources/Private/Language/locallang_be.xlf:record.orderby
recordOrderBy = crdate
# cat=custom records; type=options[DESC,ASC]; label=LLL:EXT:slug/Resources/Private/Language/locallang_be.xlf:record.order
recordOrder = DESC
And here is how I use the settigs in any Controller I want:
<?php
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
class ExtensionController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
public function __construct() {
$this->backendConfiguration = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('slug');
}
public function myRandomFunction(){
$variable = $this->backendConfiguration['recordMaxEntries'];
}
}
This is how it looks:

Is there a way to add an ID to a file on includeJS array in Typo3 8?

Or in includeJSFooter I have tried
includeJSFooter {
initJavascript = path/to/file/init.js
initJavascript.id = initJavascript
}
but It does not work and I do not see any option in the docs but maybe I have missing something.
This is not possible. For this kind of inclusion you need to use page.headerData or page.footerData.
See: https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Page/Index.html#headerdata

RealURL with GET parameters

We have developed a typo3 plug in that searches for trucks. For SEO reasons, we are trying to use the realURL plug in to make the URLs friendlier to use.
On the front page we have several call to actions that link to the search page with certain search parameters. An example is bellow:
/search-results/?tx_fds_searchresults[type_name]=Trailer
This link works as expected. On the results page is a link to the listings page with more details. An example is bellow:
/listing/?tx_fds_listing[id]=119870
This link is not working. tx_fds_listing[id] is not being populated in the arguments passed to the plug in controller.
At first we thought it might be a config issue but again, it isn't present on other pages.
The ID is not a database object and may be a text string instead.
Edit:
I should add that it works fine with RealURL turned off.
We get the id as $id = $this->request->getArgument('id');
Edit 2:
Here is the error message from the logs.
[ALERT] request="28233e225150a" component="TYPO3.CMS.Frontend.ContentObject.Exception.ProductionExceptionHandler": Oops, an error occurred! Code: 201512141630381db91bba - {"exception":"exception 'TYPO3\\CMS\\Extbase\\Mvc\\Exception\\NoSuchArgumentException' with message 'An argument \"id\" does not exist for this request.'
I also tried renaming the variable to name, but that didn't work either.
I have a solution that solves the root cause of the problem, if not the specific issue.
So I had to add additional mapping to the realurl_conf.php file. For example to get the listing id:
$config['domain.com']['postVarSets'][3]['stock'] = array(array('GETvar' => 'tx_fds_listing[id]'));
This makes the effective URL:
/listing/stock/119870
This was the intended usage for the plugin, so this is a good result. I also added configuration for ajax and pdfs. This required modification to the typoscript that was not obvious.
PDF TS:
pdf = PAGE
pdf {
typeNum = 300
10 = USER_INT
10 {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
#vendorName = TYPO3
extensionName = Fds
pluginName = Listing
#controller = FDS
controller = Tx_Fds_Controller_FDSController
#action = listingPdf
switchableControllerActions.FDS.1 = listingPdf
}
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:application/pdf
xhtml_cleaning = 0
admPanel = 0
}
}
PDF RealURL Config:
$config['domain.com']['postVarSets'][3]['pdf'] = array('type' => 'single', 'keyValues' => array ('type' => 300));
PDF effective URL:
/listing/pdf/stock/119870

moodle 2.7 filemanager issue

I'm working with a file manager on a form in moodle 2.7.
The save and upload files features are fine.
I need to determine if the file manager object currently holds a file.
This is what I've tried:
if($draftitemid = file_get_submitted_draft_itemid('attachments')){
$A=1;
}else{
$A=2;
}
But it always return 1;
[SOLVED]
Just after saveing the form files and before update record I use:
$fs = get_file_storage();
$files = $fs->get_area_files($context->id, $component,$path, $itemid,'',false);
if(!empty($files){
$A=1;//have files
}else{
$A=2;//No files
}
this work for me.
This line:
$draftitemid = file_get_submitted_draft_itemid('attachments')
Sets $draftitemid to the value returned by file_get_submitted_draft_itemid('attachments'). Setting a variable always evaluates to true when in an if statement. Thus, this is a typo and what you want is:
if($draftitemid == file_get_submitted_draft_itemid('attachments')){

XML sitemap which includes tt_news articles

Currently I'm using mc_googlesitemap. I've read that I can include tt_news articles in the xml output when using "Google Sitemap for Contents". In the documentation you have an option Table where the contents live but this is not available for me. I only can choose "Google Sitemap for Contents" and than I have "Selected Pages". There are no such option as seen in the docu and as described here.
I'm using Typo3 4.7.10 and mc_googlesitemap 0.4.2.
I also tried weeaar_googlesitemap but here in the xml output I only see the page itself where the plugin was configured to display its output. Accessing Web -> GoogleSitemap doesn't work because of the deprecated function
Fatal error: Call to undefined method t3lib_div::fixed_lgd_pre() in
/usr/home/xxx/typo3conf/ext/weeaar_googlesitemap/mod1/index.php
on line 121
I found this fix but currently I cannot adapt the source files because I've no permissions.
How do I get an xml sitemap which can also display me tt_news articles of a certain category?
Edit:
I fixed the deprecated warning and my TS looks like the following (for the weaar sitemap):
#############################
# Sitemap
#############################
sitemap = PAGE
sitemap {
typeNum = 200
10 >
10 < plugin.tx_weeaargooglesitemap_pi1
10.pid_list = 1
10.recursive = 0
10.allowedDoktypes = 2,1,4
10.domain = http://www.domain.com/
10.tt_news.single_page {
1 = 78
1.pid_list = 77
}
10.tt_news {
disabledParameter = day,month,year
}
config {
disableAllHeaderCode = 1
additionalHeaders = Content-type:text/xml
no_cache = 1
xhtml_cleaning = 0
}
}
I have the following problems:
Hidden Pages are shown in my sitemap.xml (there is no page with doktype 5 allowed)
tt_news articles are not displayed (what is wrong with my configuration?)
Explanation:
10.pid_list = 1 // this is my main entry point
10.tt_news.single_page.1 = 78 // this is my page id where the single view of tt_news resides
10.tt_news.single_page.1.pid_list = 77 // this is my sysfolder where the news are placed
What I'm doing wrong? Alternatives?
There is an extension called tq_seo which does all the SEO magic for your TYPO3 site. It's quite easy but also powerful.