When developing a module that will be reused outwith the scope of any one particular project i.e. using the community code pool, should I use the base theme to store my template, layout and skin files?
I am almost 100% certain that i should, but i see so many community modules using the default skin and theme directories that it has planted a tiny seed of doubt.
Yes, you should absolutely be using base/default for your community modules theme - in doing so you are utilising the fallback hierarchy Magento provides, allowing your theme to be portable and easy to extend by clients wishing to do so.
I'm not expecting upvotes for this answer, but would like to clarify on Tim and Drew's answers:
Unfortunately at the moment Magento only provides us with 3 levels of fall-back:
base/default
current_package/default
current_package/current_theme
Because 'current_package' is 'default' on standard Magento installations, you will often see extension developers place their files in 'default/default'. That is poor decision-making as it will mean the files will no longer be found when a non-default package is specified.
Obviously placing files in 'base/default' is also not the most optimal place, because in a sense you are removing the distinction between core and 3rd-party files. As others have mentioned, right now it is the only way of reliably adding your files while still allowing fallback to take place.
Fortunately, this will not be an issue in Magento 2, as these files will be part of modules instead, allowing pretty much infinite fallback.
Yes. Best practice is to create
app/design/frontend/base/default/template/your_extension_dir/
and
app/design/frontend/base/default/layout/your_extension_dir/
and put your files there.
Related
I'm beginner in Joomla So please any one help me. I'm editing on less files in both locations (media/guild/less/ and templates//less/) but changes are not reflected in front-end. Why has not reflected changes in the front-end.
It seems that your less files are not compiled to css, so no changes appear. Less can be compiled in the browser using Javascript, or via the commandline. I my opinion, there are only very few cases, in which it makes sense to compile in the browser.
To compile those files from the commandline you can have a look here
If you are new to Less/npm and all other needed stuff, you should have a look at the official docs.
As #philipp points out, Less files need to be compiled before they can be used.
Templates that use Less handle this in different ways. For example, Less files might be recompiled and saved each time you save the template settings. Deleting the Joomla cache and refreshing the front-end of the website might also trigger a recompile of the Less files.
For simple and future proof changes, it is often easier to override the CSS via a custom CSS file compared to editing the Less files directly.
This might be more of a user question rather than a developer question. but developers should be able to offer insights.
For the person creating and editing content, what's the best practice for where to store images associates with pages? (I'm referring to the Plone folder, not the file system directory).
Should it be stored inside the same folder as the content item itself? Or a subfolder within the working directory? Or a special directory writeable by all for storing images?
If you do some sort of shared image upload Plone folder, what would the permissions on that Plone folder be? Once again, I'm referring of course to the Plone folder, not the file system directory.
I see that in the site admin TinyMCE options you can configure some default paths for image uploads. How would you do it so that the user won't be overwhelmed by all the images in a common images folder? (in other words, he can see and edit only his own image uploads).
This is truly a serious weakness in Plone, in the sense there is no "Best or More Oftenly Recommended Way". As #keul highlighted, Plone is flexible enough to support almost every imaginable usecase, nevertheless I can't see much of a consensus - neither a set of common steps - to fulfill the common usecase you described, in a hierarchical-and-permissioned paradigm.
That said I recommend you to check and share opinions, feature requests and code on the second of these:
https://pypi.python.org/pypi/Products.ImageRepository
https://github.com/plone/plone.app.mediarepository
Both focus on easing the use of tags to manage the overwhelming of items you described. I believe this kind of problem would mostly arise when adding images inside TinyMCE sessions, say, adding a News item. However if you just need to update images for sections or the homepage I recommend you to take a look at collective.cover:
http://www.youtube.com/watch?v=h_rsSL1e4i4
btw I also recommend you to check these solutions for richer image handling:
https://pypi.python.org/pypi/plone.app.imagecropping
https://pypi.python.org/pypi/Products.ImageEditor
https://pypi.python.org/pypi/unweb.iptc/
I am working on an web built in PrestaShop that needs some re-design. I have made a copy of their theme and I am working there. Now I need to add some javascript files and they need to be included in all my theme pages.
I have read similar questions here and looked for info and basically I have found two solutions proposed:
1) Add the file directly into your HEAD.tpl using something like {$base_dir}
(explained here: Prestashop root directory)
2) Add the files in the FrontController.php (overrides/classes) with a new setMedia() function
(explained here: http://tinyurl.com/cxucwq7)
The second solution seems the most recommended one but when I open the FrontController.php I see the following warning:
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer versions in the future.
So I'm a bit confused now. Is it safe to edit this file? How about future upgrades, will they overwrite any changes made there? Isn't it safer to add them to your themes header.tpl and not affect the core of the cms?
(This is my first question here, I tried to follow the guides but I would appreciate any comments on how can I improve it, thank-you!)
It is totally safe to use the override file, and that's why they exist. I have used them in every Prestashop I made and they've never had been replaced in an update. The text they put is for the license, they probably just copy/paste it everywhere.
I wouldn't recommend manually adding the files to the header.tpl. It will work, but the advantage of adding it with the Tools::addJs() method is that the script will be concatenated with all the other scripts.
I have heard a lot of people in the Magento community mention the benefits of using a local.xml for Magento theme development
I can understand the benefits and I actually can't think of any cases where its use could be detrimental.
Are there specific situations where local.xml is a bad choice? If there are, then what would those be?
MagePsycho's points are all correct, so I'll offer the following adding onto them.
local.xml layout file is only appropriate for the end-implementer, of course - makers of distributed modules should ensure that their modules configure & use a new layout update file. This may or may not be assumed in the original question, but it bears mentioning.
Also, in the case of a multisite installation, if several site themes share a common set of layout updates, but one or more site requires further updates, then it is ideal to create a custom module which configures a layout file to collect the common local layout changes. This allows for theme-specific local.xml files which do not contain duplicated layout updates.
The local.xml file of your theme's layout is always loaded last. Therefore, you can override the existing layout node and customize your layout according to your project's requirements.
Also, using local.xml is upgrade-proof in the sense that a single layout xml contains only necessary xml layout updates.
It may take you some time to adjust the design via local.xml because you can't comment an unnecessary block's nodes; you must remove the block via xml remove nodes. Also, you have to take care while sorting the block positions.
However, once you are done with one theme using local.xml then you can easily reuse the same concept (with some modification) for other themes.
Overall, using local.xml:
Makes your system more upgrade-proof
Saves time for future projects
Fewer number of files = less overhead :)
Hope this makes some sense :)
Cheers!
CKeditor's installation instructions tell me to just unzip the whole distribution file on my webserver's production directory. But it is full of files I definitely don't want there, like source code, examples, and even server-side code in PHP. I got rid of most of these files but there is one I'm not sure about: contents.css.
I can see this file uses a lot of styles I definitely don't want to see in my site. My question is:
Is contents.css required by CKeditor, or used by default? Do I even need this file on my production site?
I suppose it depends on what you're using in CKeditor, or what you plan to use later. Personally, I'd suggest renaming the file (something like) contents.css.old and creating a new contents.css file, copy across all the styles that you think you'll need and then destruct-test your implementation of CKeditor, to assess whether you've got all the styles that you need.
Add to, or remove from, that file to get your finished version and then use that one. I'd strongly advise keeping the original version around though, for future development purposes.
To your specific questions, though:
Is contents.css required by CKeditor, or used by default?
I believe so.
Do I even need this file on my production site?
Not so far as I know, its absence will likely cause things to look a little less-pretty, though, until you apply your own styles.
As suggested, above, though, I'd rename the original and then create your own stylesheet with the same name, it's rather easier than going through all the various js files looking for, and changing as appropriate, references to contents.css.