I know that CakePHP comes with the option to add the timestamp at the end of the assets file for them to be cached, but I want to find the best practice to include instead of timestamp the version and to use it only for some css and js files.
What I had in my mind is to create a helper function which will append the version to the filename but this means that I need to change a lot of files which are included in the page.
Related
I have a list of html files in a folder with naming convention file-name + time-stamp (for example report122345). Here 122345 is file creation hour minutes second. I want to select the latest file and open it by another html code.
Well, you cannot do in pure HTML. You’ll need to add some Javascript.
(Look at How do I load an HTML page in a <div> using JavaScript? )
Basically you need 1 or 2 web services :
Returns all filenames, so you javascript can chose the one to load
Load the demanded file
If conditions are not dependents on client entry, you can combine both of them.
Let's say that i have file /home/foo/myfile without extension. Is there option to add syntax setting into this file? In vim it's :set syntax=javascript. I know that in Sublime you can set default syntax color.
There's similar question Changing default syntax based on filename but there you set specific filename. I need to set it in file itself, since i have a lot of different files without extension.
The package ApplySyntax should be able to do what you want.
ApplySyntax is a plugin for Sublime Text 2 and 3 that allows you to
detect and apply the syntax of files that might not otherwise be
detected properly. For example, files with the .rb extension are
usually Ruby files, but when they are found in a Rails project, they
could be RSpec spec files, Cucumber step files, Ruby on Rails files
(controllers, models, etc), or just plain Ruby files. This is actually
the problem I was trying to solve when I started working on this
plugin.
Set your rules/filenames in the ApplySyntax.sublime-settings file:
// "rules" is a list (array) of checks that you want to make against
the file in the current view. A rule is either a regular expression
or a function. If using a regular expression, you can specify
whether you want it tested against the "file_name" or the first
line of the file (think shebangs and xml files). If the rule is a
function, you must provide the path to the file containing the
function and the name of the function to call. When this function is
called, the "file_name" will be passed to it as the only argument.
You are free to do whatever you want in your function, just return
True or False.
you can do this on the fly through the command menu (on OSX cmd+shift+p, windows ctrl+shift+p) then type what you need (e.g. javascript) and it will come up in the list set syntax: JavaScript.
Sublime will remember this until you close the file
I'm new to Joomla.
I'm having a small doubt coming to creating Joomla templates. In the file structure provided by joomla I can see only index.php file. My doubt is can we create a Joomla template using HTML also. so that in the file structure it reads index.html.
Thanks in Advance and Merry Christmas.
It is important here to distinguish between "can" and "should" here. I believe you "can" make a template in an html file without losing all of the Joomla functionality because Joomla places modules using tags like <jdoc:include type="modules" name="user4" /> which it will parse. I'm not positive, but fairly certain that the template does require a php to bootstrap it, but you could just have the php file include the html you want to use. The major drawback is that you will be losing all of the php helper methods that Joomla makes available for you, like JURI::base() for dealing with paths for your scripts/css, etc.
You definitely should take advantage of Joomla's capabilities with php, so use the php file. If you want to include some html files into that document, that's just fine.
I don't think you can do that. The index.php file you are referring to is the root index file, while each template has its own index.php file inside their folder inside templates folder. For example templates/beez3/index.php Joomla includes the index.php file of the chosen template during it's execution cycle. Failing to find such a file it will fall back to a preinstalled template throwing an error: The template for this display is not available. Also the frontend requests start by loading the root index.php file first and then proceed to other calls and <jdoc:include type="component" /> won't load anything as it won't have any framework loaded or any joomla functionality at all. Finally no extension will work since they all require the _JEXEC constant to be defined as it's being defined in the root index.php file:
/**
* Constant that is checked in included files to prevent direct access.
* define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower
*/
define('_JEXEC', 1);
It must be written in php and you can certainly keep your theme that you created within the template folder, as for keeping .html you can always use htaccess to serve whichever extension you want.
I'm using the latest version of LibTiff.Net to fix some tiffs to be included in X9.37 files. I have got all the correct tags down, however, there are a couple of them that are DataType 'short' when I need them to be 'long'. Is there a best way to change just the datatype? Or will I have to create a custom tag?
I think you will need to at least rewrite each directory in your TIFFs. But please make sure the library writes relevant tags with the data type you need (or change the source code of the library if it doesn't).
In case X9.37 files (I don't know what it is) require TIFF directory to be placed in certain places of the file, you might be forced to recreate the file completely (by copying tags and raw raster).
I'm looking to combine and minify my JavaScript files. I have a question; on my pages I basically have the same library JS files, and then one 'specific' JS file to run code for that page. I also have variables defined in that specific JS file which are then used elsewhere in the library JS files. For example, I defined var tablename which is then used in a library file to render out a table using what is set as 'tablename'.
My question is, if I combine all of my JavaScript files from all of my pages into one big JS file, and then include that combined/minified file on my pages, then as a result of combining all of the files then that big JS file will have multiple .ready() events and the same variable tablename will be defined multiple times. How is this overcome? Maybe it can't in my situation and I'll need to create a combined/minified file for each of my pages?
Thanks
I think I found the solution; YUI Compressor (that I'm using) doesn't munge global variables, and since my tablename variable will be global (not in a function) then it won't get munged.