I am trying to find out, what has changed in TYPO3 V10.4 with backend layouts. I have got a sitepackage extension, that was working with TYPO3 V9.5 and earlier with following typoscript configuration:
page.10 = FLUIDTEMPLATE
page.10 {
partialRootPath = {$resDir}/Private/Partials
layoutRootPath = {$resDir}/Private/Layouts
file.stdWrap.cObject = CASE
file.stdWrap.cObject {
key.data = levelfield:-1, backend_layout_next_level, slide
key.override.field = backend_layout
# Default Template
default = TEXT
default.value = {$resDir}/Private/Templates/Grid_12_Template.html
## weitere Templates
pagets__1 = TEXT
pagets__1.value = {$resDir}/Private/Templates/Grid_12_Template.html
pagets__2 = TEXT
pagets__2.value = {$resDir}/Private/Templates/Grid_6-6_Template.html
pagets__3 = TEXT
pagets__3.value = {$resDir}/Private/Templates/Grid_8-4_Template.html
...
}
...
In constants.typoscript there is
## Resource Path
resDir = EXT:wtsitepackage9/Resources
What could be the main changings you have to do for V10.4? I tried the examples from https://docs.typo3.org/m/typo3/tutorial-sitepackage/master/en-us/TypoScriptConfiguration/Index.html but didn't get it working yet.
The typoscript configuration for FLUIDTEMPLATE above is still usable and working. The problem sat in the ext_localconf.php file of the sitepackage extension.
OLD until V9:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/Configuration/TSconfig/Page.txt">'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(
'<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/Configuration/TSconfig/User.txt">'
);
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['custom'] = 'EXT:' . $_EXTKEY . '/Configuration/RTE/Custom.yaml';
New from V10
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
'#import "EXT:wtsitepackage/Configuration/TSconfig/Page.txt">'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(
'#import "EXT:wtsitepackage/Configuration/TSconfig/User.txt">'
);
$GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['custom'] = 'EXT:wtsitepackage/Configuration/RTE/Custom.yaml';
After that changes the backend layout is selectable again.
Related
I'm trying to run some automated tests with Selenium in Firefox in normal view (not headless). I want to set the viewport to width=375, height=812 (iPhone X), but starting on Firefox 75 they set the minimum width to 450px (Firefox bug tracker).
I've read some posts saying you can use the userChrome.css file to modify this setting but they only seem to work on Linux and not on macOS nor Windows 10.
How can I force Firefox to allow me to set a viewport of less than 450px?
The solution is to create a profile.zip with the chrome/userChrome.css with the following content:
#main-window:not([chromehidden~="toolbar"]) {
min-width: 50px !important;
}
and a user.js with the following content:
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);
The profile.zip need to be given as a base64 encoded string to the remote web driver. Not sure how this is done in selenium.
PHP Web Driver Solution
Lot of spaghetti code but this is what worked for me using php web-driver library. Creating a profile and unpack the profile again and then add the userChrome.css. Tested on macOS:
// create firefox profile zip
$profileZipPath = __DIR__ . '/profile.zip';
$firefoxProfile = new FirefoxProfile();
$firefoxProfile->setPreference('toolkit.legacyUserProfileCustomizations.stylesheets', true);
$firefoxProfile = $firefoxProfile->encode();
file_put_contents($profileZipPath, base64_decode($firefoxProfile));
// unpack profile zp
$zip = new \ZipArchive();
$zip->open($profileZipPath);
$profilePath = __DIR__ . '/profile';
$zip->extractTo($profilePath);
// add chrome/userChrome.css
$cssDirectory = $profilePath . '/chrome';
mkdir($cssDirectory);
file_put_contents($cssDirectory . '/userChrome.css', <<<EOT
#main-window:not([chromehidden~="toolbar"]) {
min-width: 50px !important;
}
EOT
);
// create profile zip
$zip = new \ZipArchive();
$zip->open($profileZipPath, \ZipArchive::CREATE);
$dir = new \RecursiveDirectoryIterator($profilePath);
$files = new \RecursiveIteratorIterator($dir);
$dir_prefix = preg_replace(
'#\\\\#',
'\\\\\\\\',
$profilePath . DIRECTORY_SEPARATOR
);
foreach ($files as $name => $object) {
if (is_dir($name)) {
continue;
}
$path = preg_replace("#^{$dir_prefix}#", '', $name);
$zip->addFile($name, $path);
}
$zip->close();
// use the new profile
$firefoxProfile = base64_encode(file_get_contents($profileZipPath));
$capabilities = DesiredCapabilities::firefox();
$capabilities->setCapability(FirefoxDriver::PROFILE => $firefoxProfile);
// ...
I'm coding since 2 year and learning cakePHP since a few weeks , and i'm actually in internship trying to deploy a website.
I have trouble with Html2PDF , as it work well on the local version, but not on the server (a new page is opened , with the right url , but the pdf is blank).
the newly opened blank page contain this error message (displayed on the f12 debug console) :
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
the Html2PDF code :
function exportFicheVie() {
$Equipement = $this->Equipement->getEquipement($_GET['Id']);
$PersonnesRessources = $this->Equipement->getPersonnesRessourcesOfEquipement($_GET['Id']);
$Prestataire = $this->Equipement->getPrestataireOfEquipement($_GET['Id']);
$Verifications = $this->Equipement->getVerif($_GET['Id']);
$Contrat = $this->Equipement->getContrat($_GET['Id']);
if (count($Contrat)==0)
$Contrat[0] = "Non";
$Vide = array(
"Prenom"=>"",
"Nom"=>"",
"NumPoste"=>"",
"Mail"=>"",
"Adresse"=>"",
"Fax"=>"",
"Telephone"=>""
);
if (count($PersonnesRessources)==0)
$PersonnesRessources = array($Vide, $Vide);
elseif (count($PersonnesRessources)==1)
$PersonnesRessources[] = $Vide;
if (count($Prestataire)==0)
$Prestataire = $Vide;
// convert in PDF
require_once(__DIR__.'/../webroot/theme/plugins/html2pdf/vendor/autoload.php');
try
{
$Html2pdf = new HTML2PDF('P', 'A4', 'fr');
$NbPages = $Html2pdf->pdf->getAliasNbPages();
$NumPage = $Html2pdf->pdf->getAliasNumPage();
include($Html2pdf->getHtmlFromPage(__DIR__.'/../View/Equipements/export_fiche_vie.ctp', $Equipement, $PersonnesRessources, $Prestataire, $NbPages, $NumPage));
$Content = ob_get_clean();
//$Html2pdf->setModeDebug();
$Html2pdf->addFont('Century Gothic', 'normal', __DIR__.'/../webroot/theme/plugins/html2pdf/vendor/tecnickcom/tcpdf/fonts/centurygothic.php');
$Html2pdf->addFont('Century Gothic Bold', 'normal', __DIR__.'/../webroot/theme/plugins/html2pdf/vendor/tecnickcom/tcpdf/fonts/centurygothic.php');
$Html2pdf->setDefaultFont('Century Gothic');
$Html2pdf->writeHTML($Content, isset($_GET['vuehtml']));
$Html2pdf->Output('\FS-'.$_GET['Id'].'.pdf');
}
catch(HTML2PDF_exception $e)
{
echo $e;
exit;
}
}
I don't expect an miracle answer , because this question appear a lot without any clear solution , but any hint, advice or supposition would be welcome .it's my first time putting a website on a real server they might be some obvious things I miss.
How to pass variable from another lua file? Im trying to pass the text variable title to another b.lua as a text.
a.lua
local options = {
title = "Easy - Addition",
backScene = "scenes.operationMenu",
}
b.lua
local score_label_2 = display.newText({parent=uiGroup, text=title, font=native.systemFontBold, fontSize=128, align="center"})
There are a couple ways to do this but the most straightforward is to treat 'a.lua' like a module and import it into 'b.lua' via require
For example in
-- a.lua
local options =
{
title = "Easy - Addition",
backScene = "scenes.operationMenu",
}
return options
and from
-- b.lua
local options = require 'a'
local score_label_2 = display.newText
{
parent = uiGroup,
text = options.title,
font = native.systemFontBold,
fontSize = 128,
align = "center"
}
You can import the file a.lua into a variable, then use it as an ordinary table.
in b.lua
local a = require("a.lua")
print(a.options.title)
I'm using Laravel with the snappy wrapper. It is all working except that it saves the PDF's into the public folder. I want it to go to a different folder. There is nothing obvious on the snappy git site, nor in the config. And the wkhtlptopdf docs are very sparse imho. How do I change the $pdf->save() statement so it goes where I want it to go ?
My PDF is generated by laravel like this:
if( $email == 'email'){
$quotation = $this->quotation->get_PdfQuote($ref);
$pdf = PDF::loadView('quotations/pdf_quotation',compact('quotation') );
$pdf->save($ref.'.pdf'); //THIS SAVES INTO THE PUBLIC FOLDER.
$title = 'Your Quotation';
$firstname = $customer['firstname1'];
$pathtoFile = '/var/www/auburntree/public/'.$ref.'.pdf';
Mail::send('emails.quotation', ['title' => $title, 'firstname'=>$firstname ], function ($m) use($customer,$pathtoFile) {
$m->from('myemail#gmail.com', 'Auburntree');
$m->to($customer['email1'],($customer['firstname1'] . $customer['lastname1']))->subject('Your Quotation');
$m->attach($pathtoFile);
});
Flash::success('The Quote Has Been Saved. An Email has ben sent to the customer ');
return redirect ('quotes');
} else
Ok, I hope this helps someone else.
$quotation = $this->quotation->get_PdfQuote($ref); //pulled in from DB
$pdf = PDF::loadView('quotations/pdf_quotation',compact('quotation') );
$filename = base_path('public/pdf/'.$ref.'.pdf');
$pdf->save($filename);
Magento 1.6 was out at the beginning of this week but upgrading from 1.5.1 with the mage_googleshopping extension (http://www.magentocommerce.com/magento-connect/Magento+Core/extension/6887/mage_googleshopping) up to v.1.6 was not something feasible.
mage_googleshopping remained compatible only with 1.5. Any working alternative to have the mage_googleshopping extension available on a clean Magento 1.6 installation or we have to wait for a stable extension release which goes with v.1.6?
Cheers,
Bogdan
I have browsed the Internet and searched for a problem to this, eventually I've turned into this script which runes separately but it connects to the Magento DB. The scripts generates the file, which can be uploaded following a schedule to Google.
Besides the fact that the script is totally editable, you can fully monitor all the processes behind it. The Magento script still can't be removed from a 1.6 Magento version.
The script wasn't developed by me but I did update it according with the latest rules enforced from 22/9/2011 by Google.
<code>
<?php
define('SAVE_FEED_LOCATION','google_base_feed.txt');
set_time_limit(1800);
require_once '../app/Mage.php';
Mage::app('default');
try{
$handle = fopen(SAVE_FEED_LOCATION, 'w');
$heading = array('id','mpn','title','description','link','image_link','price','brand','product_type','condition', 'google_product_category', 'manufacturer', 'availability');
$feed_line=implode("\t", $heading)."\r\n";
fwrite($handle, $feed_line);
$products = Mage::getModel('catalog/product')->getCollection();
$products->addAttributeToFilter('status', 1);
$products->addAttributeToFilter('visibility', 4);
$products->addAttributeToSelect('*');
$prodIds=$products->getAllIds();
$product = Mage::getModel('catalog/product');
$counter_test = 0;
foreach($prodIds as $productId) {
if (++$counter_test < 30000){
$product->load($productId);
$product_data = array();
$product_data['sku'] = $product->getSku();
$product_data['mpn'] = $product->getSku();
$title_temp = $product->getName();
if (strlen($title_temp) > 70){
$title_temp = str_replace("Supply", "", $title_temp);
$title_temp = str_replace(" ", " ", $title_temp);
}
$product_data['title'] = $title_temp;
$product_data['description'] = substr(iconv("UTF-8","UTF-8//IGNORE",$product->getDescription()), 0, 900);
$product_data['Deeplink'] = "http://www.directmall.co.uk/".$product->getUrlPath();
$product_data['image_link'] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$product->getImage();
$price_temp = round($product->getPrice(),2);
$product_data['price'] = round($product->getPrice(),2) + 5;
$product_data['brand'] = $product->getData('brand');
$product_data['product_type'] = 'Laptop Chargers & Adapters';
$product_data['condition'] = "new";
$product_data['category'] = $product_data['brand'];
$product_data['manufacturer'] = $product_data['brand'];
$product_data['availability'] = "in stock";
foreach($product_data as $k=>$val){
$bad=array('"',"\r\n","\n","\r","\t");
$good=array(""," "," "," ","");
$product_data[$k] = '"'.str_replace($bad,$good,$val).'"';
}
echo $counter_test . " ";
$feed_line = implode("\t", $product_data)."\r\n";
fwrite($handle, $feed_line);
fflush($handle);
}
}
fclose($handle);
}
catch(Exception $e){
die($e->getMessage());
}</code>
Change www.directmall.co.uk into what you need.
Assign the proper permissions.
Fully updated according with Google's requirements.