How to clean Movable Type cache in tag templates - movabletype

I have modified my MT templates and publish all my static files. However the tags templates are nor refreshed:
http://www.example.com/tags/tag-name/
It looks that they are cached inside the tagcache folder. How can I refresh them?
Thank you.

MT does not produce such clean URLs for tags, it uses the internal search engine and URLs such as those: MT_HOME/mt-search.cgi?blog_id=1&tag=Tagname&limit=20
You need to tell us how http://www.example.com/tags/tag-name/ is really produced (either the MT template code or the web server rewrite rule that produce this clean URL scheme).

You need to specify more about your MT versions and how tags is implemented.
Usually, Tags are implemented using the internal search. this search have a life time that is 20 seconds by default. (see it you have SearchCacheTTL in your mt-config.cgi)
failing that, you can check the database and clear all the session raws that have kind="CS". (this is where the cache is. unless you are using memcache)
Good luck.

Related

Write custom grid layouts with extbase/fluid but without any extension like gridelements

I look for a tutorial, help or an example that tells me what I have to do to write a grid element like 2-colums in basic typo3 (v9) with fluid but no other extension like gridelements, DCE, Templa Voila, etc. I want the same gridelements can do but I dont want to be depended to this extention and move it in my own site extention.
I tried the same with normal content elements (CE) like here:
https://docs.typo3.org/c/typo3/cms-fluid-styled-content/9.5/en-us/AddingYourOwnContentElements/Index.html
But how can I nest a CE in a CE? And how can I do this by drag&drop in the backend?
You can't. The page module doesn't support nesting
You can't nest CEs in a CE. On database level this would mean that you have to make a tt_content record a subrecord of a parent tt_content record. You run into several problems, basically the multilanguage support will be broken and the shortcut element does not function as you will expect it to. That is why the extensions "gridelements" and "mask" exist.
I integrated the gridelements configuration into my sitepackage. So I do not need to bother anymore with it.
Just for your info:
There is now an initiative that works on integrating this functionality into the core (Structured Content Initiative, https://typo3.org/article/a-structured-content-initiative/). Stay tuned to it.
There is nothing special about providing Gridelements via external files, since it's based on TSconfig, TypoScript and Fluid. That's why there is not that much about it in the documentation, since it's the same thing you would do with any other kind of sitepackage. The TSconfig and TypoScript parameters are already explained there, while the Fluid would be up to you anyway.
To have a kind of kickstarter just take any extensions providing Gridelements layouts as an example. A very popular one would be bootstrap_grids, which can be found in the TER or here: https://github.com/laxap/bootstrap_grids
You don't necessarily need the flexform controller of that extension, but the Configuration and Resources folders, show you how to configure stuff and you can see how that is included via ext_localconf.php
There are even comments i.e. in the TSconfig files to explain what is possible there and how to handle i.e. mixed environments with record and file based setups. Although it would be recommended to go for files.
You would at least have to add the necessary backend rendering methods to a draw item hook, that will modify the preview of the container element.
So basically you would have to rewrite everything that DCE, Flux, Gridelements or other similar extensions already do.
Which brings us to the question, why you want to avoid those extensions, since especially those three are well known, widely spread, well supported and available for currently supported TYPO3 versions.

Kentico 10 - Web Part content change via database

i was trying to understand in the Kentico's database model how can i change the web parts content using a database script.
So, basically i have a website based on Kentico with several articles, and internal hyperlinks in its content. But the problem is that the format of those hyperlinks are actually invalid. And i was looking for a way to build a script and do a bulk-update in order to replace some characters and update those hyperlinks to the valid format.
Any idea how can i build the query to get the content of all web parts used in all published pages.
Thank you
It depends on your web parts and how the content is rendered. There are different ways that web parts render their content:
The web part layout is used for markup
The ASCX file for the web part is used for markup
The web part makes use of a repeater that uses a Transformation to render the markup- The markup is generated in code behind
The last one can be tricky to change depending on the web part and whether you have access to all the code behind, but the others you can change either in code in your solution or within the Administration area itself.
Doing this in SQL would probably require a combination of T-SQL XML support and regular expressions to find what you're looking for. you effectively need to look in the CMS_WebPart and CMS_WebPartLayout tables to find what you're looking for.
However, reading your query, I'm not 100% sure you're talking about web parts, (my apologies if you are) as you talk about links in the article content itself. If these are set using the Editable text web part, then you need to look in the CMS_Document table at the DocumentContent field to find the links to replace. But you then need to look at how to correctly format those links going forward so that you do not need to repeat this process later.
Note:
You need to be really careful when doing this in SQL to make sure that you don't create invalid XML. Things go bad when you do that.
This won't flush your cache, so you'll need to clear your cache manually afterwards.
If you're using out-of-the-box web parts, you should really make a copy of them and use the copy if you're going to modify, this way, you're less likely to have pain in future upgrades.
Typically "content" is not set in a webpart. Webparts are configured to retrieve content from page types. There is an exception to this with specific webparts like Editable Text, Static Text, Static HTML, etc.
The configuration of a webpart is stored at the template level in the cms_pagetemplate table. The configuration for ALL webparts on that page template are stored in the PageTemplateWebParts field. So you'd have to parse through the XML and get the proper webpart and then perform an update on that field. You maybe able to do a regex to find that content and replace it as well.
Not ideal to do this via SQL simply because of version history and it can cause a lot of problems later on. I'd suggest finding out which API calls you can make to perform these updates and write a small program for it.

Automatic cache-busting for static builds that works well with npm run?

I use npm as my build tool, by populating the scripts field with various commands for the tasks I need. I’m satisfied with the setup, except for one small detail: when building for production, I’d like for references to CSS files in <link> tags and references to JS files in <script> tags to be updated for cache busting (i.e. to be modified by appending ?random_string to the file names, or similar).
I’m using jade, in case there’s a way to do it that way that I missed.
I don’t mind if the solution busts every file, even if they weren’t changed since the last build. What I care is that it does not require me to add complex code to the website itself (like a function with this as its sole purpose); it should preferably be an external command.
So far, I haven’t been able to find an acceptable solution. I’m almost about to resort to a regex, but would really rather have a more robust solution.
Since Jade allows executing any piece of Javascript code you can append a datestring at the end of your URL as a query string which is the standard way of invalidating cached scripts:
script(src="/app.js?#{Date.now()}")

I have a small code on the end of each image link on my site that I didn't add. Does anybody know what this is?

mywebsiteurl.net/image.jpg?9a7ad6
What is this "?9a7ad6" after each image link? I noticed this when I copy pasted the url of an image.
I googled it, but the only relevant thing that I could find is that #9a7ad6 is the hex code for purple.
Some WordPress themes/plugins use query strings to do neat things to images on the fly like resizing. In this case, the query string (stuff after the ?) is likely being used to prevent caching. If that is the case, here's how to fix it:
There's a setting under Browser Cache → General that says Prevent
caching of objects after settings change → Whenever settings are
changed, a new query string will be generated and appended to objects
allowing the new policy to be applied. Disable that (if you're using
the plugin) and those query strings will be dropped on static
resources like .jpg and .png files.
Source: Philip Arthur Moore from WordPress.org: http://wordpress.org/support/topic/wordpress-32-images-show-weird-query-string
You may also want to take a look at this page: http://diywpblog.com/wordpress-optimization-remove-query-strings-from-static-resources/

ExpressionEngine file manager - default to thumbnail view

At the moment when you go to select an image inside an entry using the EE default file manager, the default view is 'show files as a list'.
Is there a way to show the thumbnail view as the default?
At this point I would be happy with a core hack.
I don't usually use the file manager for sites (much prefer Assets) but this client had a tight budget
I've wondered about doing this in the past as well - turns out it's pretty simple. Open up ee_filebrowser.js and search for the first instance of a("#dir_choice").val(). Immediately after that add this:
; a("#view_type").val('thumb').change();
Make sure you include the leading ;.
I've only tested this in Safari but I can't see why it wouldn't work everywhere. Incidentally, JS beautifier makes this sort of thing infinitely easier.
I don't recommend hacking core for any reason and I suggest it should be avoided at all cost.
With that said, I will provide what I've found out just the same.
Looks like the following files, in EE 2.5.3, are what you'd want to edit:
/themes/javascript/compressed/jquery/plugins/ee_filebrowser.js
/system/expressionengine/libraries/File_field.php
I found these doing a file search in my text editor for view_type which was from the id of that dropdown. The javascript is minified so you'd probably want to un-minify it and then rewrite the part which handles the switch. I'm not the best JS/jQuery person out there, and un-minified js makes it a bit harder too so, I won't offer any more than what I've found so far.
Consider pulling out the parts parts from the two files if you aren't great with js and maybe start a new post tagged accordingly.
Also note: there might be more to this than just those two files so consider this answer a start and nothing more.

Resources