Zendframework CSS Problem - zend-framework

I am very to new to zend frame work , I am trying to set up a project (Done by other programmer) in my local server, i have setted up this project, but all pages are styless in my browser, ie the CSS files are not taken in phtml pages, For solving this issue which file I have ti Edit?
Plss Help me

It depends upon the directory structure that your app has adapted. However checkout if you have views/scripts directory then, again depending upon the directory style used, the header.phtml file (if exist) will have invalid link to css.
If you dont have header.phtml, then use any text-editor and search in your views directory with keyword 'css', and you will get to know the possible file name.

Global css files I would add in the bootstrap file and any styles that relate to a page I would add in the relevant controller action for example...
global styles in bootstrap file
protected function _initView()
{
$this->view = new Zend_View();
$this->view->headLink()->appendStylesheet('css/global.css');
}
or in a specific controller action
public function myPageAction()
{
$view = $this->view;
$view->headLink()->appendStylesheet('css/myPageStyles.css');
}

Related

Typo3: How can i set common data in header and footer like logo?

I want to set a dynamic logo for mobile and desktop versions in header footer.
I want to set an email, phone number and address in the footer. how can I set all data in one place?
Should I store every page of all data?
Constant is basically for a general setting, you can create in your base template. However, sitepackagebuilder provides minimal setting.
It's pretty easy! You can create your own constant with simple code below:
Create constant, Add constant in your constant.ts (Generally file path is ext/yourExt/Configuration/TypoScript)
plugin.tx_yourplugin {
settings {
# cat=plugin.tx_yourplugin/file; type=string; label=Website Logo
siteLogo =
}
}
Now, you will find constant in your TYPO3 backend template->constant Editor module, within your extension constants.
Assign a value to setup.ts: Add below code in your setup.ts which is located in the same directory.
plugin.tx_yourplugin {
settings {
siteLogo = {$plugin.tx_yourplugin.settings.siteLogo}
}
}
Now, your dynamic value from constant can be accessible to your fluid template or your extbase controller. You will find your constant in the settings user below debug.
<f:debug>{_all}</f:debug>
Here is some useful link:
https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/UsingSetting/Constants.html
https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/UsingSetting/TheConstantEditor.html#type
As far as I know, a multiline constant and type file is not yet supported.
I hope this helps!
Check out Bootstrap Package (https://extensions.typo3.org/extension/bootstrap_package/), a popular, ready-to-use TYPO3 extension that provides a responsive theme for TYPO3. With it, you can easily customize the header and footer across all pages. As the extension's name implies, it makes extensive use of the Bootstrap framework.

Adding own CSS to TYPO3 backend [v9]

I am trying to add some CSS styles to the TYPO3 backend (v9). I've added the stylesheet and the following line to the ext_tables.php of my own extension (as described in the file typo3/sysext/backend/Classes/Template/DocumentTemplate.php).
$GLOBALS['TBE_STYLES']['skins'][$_EXTKEY]['stylesheetDirectories'] = ['EXT:my_extension/styles.css'];
When I check the configuration, the new entry show up, so that looks fine. But I don't see any style changes to the backend.
Any ideas anyone? Thanks!
As the key value (stylesheetDirectories) indicates, this should point to a directory. It will add all .css files in that directory.
Also, don't set $GLOBALS['TBE_STYLES']['skins'][$_EXTKEY]['stylesheetDirectories'] as a new array, but use $GLOBALS['TBE_STYLES']['skins'][$_EXTKEY]['stylesheetDirectories'][] = 'EXT:my_extension/styles/';. That way other extensions can also add stylesheets without it being overwritten by your extension.

how to disable particular js file in only particular view yii2

i doing ajax call and render view page in modal popup. but in this view page all js and css files are included. so in main page and ajax view page, js file got conflict.
i know how to disable js file in view page in yii-1.00
like this one
Yii::$app()->clientScript->scriptMap['jquery.js'] = false;
Yii::$app()->clientScript->scriptMap['yii.js'] = false;
but i dont know how to do this is in yii2.
so how can i do this.
thanks in advance.
This will disable bundle which conflicts others.
Write below code in particular page in where you want to disable the JS files.
unset($this->assetBundles['yii\bootstrap\BootstrapAsset']);
unset($this->assetBundles['yii\web\JqueryAsset']);
if you want to exclude the assets which are registered on the layouts
you can use return $this->renderPartial("view"); from your controller
action.
render partial
otherwise if your view contain other Javascripts/css files you want to inject into the rendering result you may use return $this->renderAjax("view") instead
render ajax
for Yii2
//in controller you can use this line...It will not reload assets with renderAjax.
\Yii::$app->assetManager->bundles = false;

How to use pdf.js with gwt [duplicate]

We have an application built on GWT framework where we want to display a PDF file without any browser plugin and are currently evaluating PDF.js to do that.
The problem is, no matter what I do, I am not able to render a PDF file onto a canvas in our GWT application. Do give some background
The PDF file ticket is retrieved from server.
The PDF.js file ticket is retrieved from server and is embedded in the HTML body by using this script
var head= document.getElementsByTagName('body')[0];
var script= document.createElement('script');
script.type= 'text/javascript';
script.setAttribute('charset', 'UTF-8');
script.src=url;
head.appendChild(script);
Canvas element is created in the View (using googles MVP pattern here) and a JSNI call is made to the script which embeds the PDF.js in the HTML body using the above function. The script then makes a call to function which works with PDFJS class defined in PDF.js file.
The function to render the PDF file on canvas is as below :
PDFJS.disableWorker = true;
PDFJS.getDocument(url).then(function getPdfHelloWorld(pdf)
{
pdf.getPage(1).then(function getPageHelloWorld(page)
{
var scale = 1.25;
var viewport = page.getViewport(scale);
canvas.height = viewport.height;
canvas.width = viewport.width;
page.render({canvasContext: context, viewport: viewport});
page.startRendering(context);
alert("Finished rendering");
});
});
The canvas and context are created in the View class and passed to the javascript.
The problem here is, after the call to JSNI is made, I show alerts of all variables. The browser shows alerts except when I make a call alert(PDFJS). This shows that PDFJS variable is not being recognised in the script.
This makes me think PDF.js file is not correctly embedded in the view or there is something else that I am missing.
Note: I have downloaded most of the examples over the net and most of them work locally i.e. I can modify the PDF.js file path to pick up a local copy and the HTML still renders the PDF. It has no problem reading the PDFJS variable. Its only in this GWT application that I see these problems.
Does anyone have any clue whats happening. Your help will be highly appreciated.
Thanks
Your problem is that you're injecting the script so it aloads asynchronously, but you don't wait until after it's loaded to start using it.
Try using ScriptInjector.FromUrl to inject the script and put the rest of your code in the Callback's onSuccess.
Injecting the script synchronously (by adding it to your HTML host page, or GWT Module descriptor —note: won't work with the xsiframe linker—), as proposed by Ilya is of course also a solution.
Try to add <script src="PDF.js"/> in your .gwt.xml file and put PDF.js file in your public director

Can I change the location of the view scripts in Zend Framework?

Right now the view scripts for my Zend Framework application are located in the application/views/scripts directory. Is it possible to change this location to something that is configurable?
I am assuming this goes somewhere in the index.php file or my application.ini file.
For convenience ZF automatically sets the view script path to be module/views/scripts/controller/action.phtml
You can add a script path via $view->addScriptPath('/path/to/view/scripts') which adds this new path to the stack of available view script paths. It checks the last one set first, then checks on the one before until it finds a file.
Or you can reset the script path via $view->setScriptPath('/path/to/view/scripts')
If you need to do this for a controller place this in your _init() method. If you need it for your entire application I'd recommend sticking it in your Bootstrap.
I believe it's also possible to place this in application.ini via: resources.view.basePath = "/path/to/views/"
See http://framework.zend.com/manual/en/zend.view.controllers.html
I found the solution using partial guesswork with the application.ini file. Here are the two Entries you can change in Zend Framework 1.11.12.
resources.layout.layoutPath = "/path/to/layouts/"
resources.view.scriptPath = "/path/to/scripts/"