Change default .phtml extension to .php in Zend Framework? - zend-framework

I use Microsoft WebMatrix as an HTML editor. Unfortunately, it doesn't recognize .phtml files used in Zend Framework by default. What can I do to change the default file extension to .php for all files in a project?

Put something like:
$view = new Zend_View();
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->setView($view)
->setViewSuffix('php');
In your bootstrap. But there must be a way to tell your editor to use phtml its sad to have to change stuff just to acomodate a editor.
ps: not tested not close to a editor but it should work.

Netbeans for php is a good alternative. .phtml are fully supported. I am using netbeans for my ZF application since last 2-3 years. works like a charm!!
check this page https://netbeans.org/features/php/

Related

Write typoscript in project files and not in backend

Okay the title may be confusing and thats because im a beginner in typo3.
So i set up a empty typo3 project via composer.
Now i want to write my typoscript "code" in my project files and not directley in the backend.
I added a template to a page and in the setup i started to define some page objects.
My problem is:
How do i tell typo3 to use the code that i write in my files rather then the code that is in the backend.
Also where should i put my typoscrip files.
I have them like this.
Also im a bit confused on why my ext directory is empty (besides what i added)
So i would like to move this code
# Default PAGE object:
page = PAGE
page {
bodyTag = <body>
meta.AUTHOR = My Name
meta.DESCRIPTION = My Website
}
To my Project file, and not do any editing in the backend.
Thank you this is my first time posting :)
I see that you've already created an extension EXT:website to store your TypoScript, Fluid templates, etc. You should proceed as follows:
1) create in your extension a php file:
website/Configuration/TCA/Overrides/sys_template.php
<?php
defined('TYPO3_MODE') || die();
call_user_func(function()
{
/**
* Default Static TypoScript for website
*/
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'website',
'Configuration/TypoScript',
'My Provider extension for pages and content'
);
});
2) create two files:
website/Configuration/constants.typoscript
website/Configuration/setup.typoscript
3) You will be able then to add the these files using the "Include static (from extensions)" area of your TypoScript template.
Of course inside these files you can include other files or even folders, see the documentation here
First of all, your project extension (let it call sitepackage) is missing some files. At least an ExtensionManager configuration file ext_emconf.php in the root of your extension 'typo3conf/ext/website' and for composer based TYPO3 installation also a Composer configuration composer.json. See documentation here https://docs.typo3.org/typo3cms/SitePackageTutorial/ExtensionConfiguration/Index.html#directory-and-file-structure
To get started with your own sitepackagae extension have a look at
https://sitepackagebuilder.com/ which helps to kickstart. It will create folder and files, which you may not need, but gives you an impression, which is best practice for file and folders inside your TYPO3 extension.
In your Installation you need to create a root template at your root page. See documentation here https://docs.typo3.org/typo3cms/TemplatingTutorial/7.6/Tasks/WorkingTypoScript/TypoScriptTemplate/Index.html#create-a-new-typoscript-template
Your sitepackage extension should includes TypoScript files under Configuration/TypoScript/, which you can include manually in root TypoScript template at your root page.
for constants
<INCLUDE_TYPOSCRIPT:source="FILE:EXT:website/Configuration/TypoScript/constants.typoscript">
and setup
<INCLUDE_TYPOSCRIPT:source="FILE:EXT:website/Configuration/TypoScript/setup.typoscript">
There are also other different ways to initial load TypoScript. See for example documentation here: https://docs.typo3.org/typo3cms/SitePackageTutorial/ExtensionConfiguration/Index.html
A description on how to load TypoScript without any root template in backend published here https://docs.typo3.org/typo3cms/Snippets/2017/Index.html#root-typoscript-without-database

HTML support in phtml file

When working with pthml file, how do I get the HTML-Intellisense like I got when working with html file?
I have the extension PHP Intelephense installed, but it's not recommending the closing tag when adding new HTML tag. Or did I configured something wrongly?
Edited:
VS Code can do this by altering the setting file association. So if I associate the phtml file with html, I get the Intellisense for html, and the same for php. I think what I really want is to associate phtml with html and php... which is impossible for now, I guess.
For reference: https://github.com/Microsoft/vscode/issues/22415
Try:
"files.associations": {
"*.phtml": "html"
}
in your settings file. This should give .phtml files the same intellisense as html files.

VSCode writing HTML in .php or .phtml files

Is there any way to configure properly, or turn off all together, the autocomplete/intellisense when coding HTML in a .php or .phtml file? For example, any time I try to close any element it starts suggesting PHP things like $_COOKIE or constantly trying to close a not even open <?php tag.
You can set "php.suggest.basic": false and then install a PHP extension to provide intellisense. I recommend this.
*Disclaimer - I'm the author

Adding custom file extension to netbeans ide

I'm using NetBeans 7.2.1 for my developments with CodeIgniter/Bonfire.
In my controllers i'm loading my for the view needed JavaScripts via
Assets::add_js($this->load->view('admin/index_js', $data, true), 'inline');
to preparse some php variables in the JavaScript (like dynamic url's).
This forces me to save these JavaScript files witht he extension ".php" so that i can load it via
$this->load->view
All these JavaScript files are using the filename syntac
*_js.php
Since i load it via view and Assets with "inline" parameter i can't put the
<script>
</script>
tags in the script so NetBeans is not recognizing it as JavaScript and i have no syntax highlightning and no formatting options.
Any idea how i can get it that NetBeans can recognize it as JavaScript?
Thanks a lot.
Okay... got it...
One of my collegues made a change to the assets library to "erase" the script tags from assets::js inline included files:
http://forums.cibonfire.com/discussion/1134/assetsjs-inline_js-change-to-load-js-via-view#Item_1

Zend Framework and MCImageManager

Anybody ever integrated MCImageManager and Zend Framework? I want to use MCImageManager in standalone mode (not as part of TinyMCE). I'm really at a loss here - don't know where to put any of the files. Do I need to create a view helper that somehow references the main index.php file of MCImageManager?
I think I figured it out. I just added the whole imagemanager directory to my public directory. That way I can just treat it like any other static files (images, css, js, etc).