How to make movable type to use relative path - movabletype

Commonly movable type will publish HTML files which contains absolute path, but if I want to host the site under different domain(e.g., both HTTP and HTTPS), it is very inconvenient.
So is there a way to change all the paths to resource of my site to absolute ones?
Thanks

I think you want "reletive" paths. The relative directories can be symlinked/aliased on the server. Once file paths are aliased...
Update your mt-config.cgi file to use reletive paths for the required config directives:
StaticWebPath
CGIPath
This is also covered in the installation guide

Short of constructing the URLs yourself in your templates, you'll need a plugin. I've found that MTRelativeURL works well, despite not being updated in a while.
The plugin adds a few new tags but the simple approach is to use the 'relative_url' filter where needed:
<$MTEntryPermalink relative_url="1"$>
Keep in mind that you'll want to continue using absolute URLs for the links in your RSS feed.

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.

Why multilevel routing in express doesn't work properly?

I'm trying to make a simple routing in node.js with express. Long story short:
app.use('/valut-servis', valut_servis); //This works
app.use('/valut/servis', valut_servis); //This doesn't
I expected these to act in a same way. They do lead to same script, but in that script, when I use res.sendFile(__dirname + '/whatever.html'); to serve an html file, all the relative paths in that file stop working, because it made itself new root named "valut" inside of it's original root folder.
I'm doing something ridiculously wrong, please help.
It works as expected, but I see how that is inconvenient here. You relative links indeed do not work when you add another / into the url of the base file.
You can
Use a <base href="/valut-servis"> tag to make your paths resolve like absolute paths
change all the paths in your file to be absolute (similar to 1, actually)
if it is just assets, have those assets also be served from the subdirectory (with something like app.use('/valut', express.static('/your_assets_folder')))
Let me know if any of those make it work for you, and which one you ended up choosing :)

How to clean Movable Type cache in tag templates

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.

htaccess working, but layout broken?

I don't know a huge amount about htacess and modrewrite, so I find myself in yet another predicament approaching this new zone for myself.
I will seperate my Inquiries over 2 different questions to allow answers to be on-topic and better targetted to users searching for solutions to their own questions.
This is the second of those 2 inquiries;
I have the following in my htaccess file;
RewriteRule ^install/([a-zA-Z0-9]+)/$ index.php?module=faq&page=howto&program=$1
The concept is that install/abcd/ would call index.php?module=faq&page=howto&program=abcd
That works. It pulls the content, matches it and shows what it is meant to. I have used server variables to show me what is being simulated and it matches up.
However the CSS and images on the page are being stripped as they are relative to the document, not statically assigned.
I am only using htaccess (For Now I guess?) for one solution, with the intention to soon impliment another fairly soon. The intention is to offer our customers easy to read URL's for support purposes, but not rewriting the entire site. SEO isnt a major issue as our site is only to be used by those it is intended for as opposed to a wide audience.
Other than statically assigning css, JS and image files, is there a way to fix this issue so that the page is displayed styled and with the javascript in tact?
Thanks for your help, I hope the question was understandable and as always I appreciate the time you guys take to help us all!
We need to either make the css links absolute (starts with a /) or add a base for all our relative links by adding an extra attribute to the header:
<base href="/">
This would mean that you we start with the subdirectory of /test/. so instead of the css being;
http://domain.com/install/abcd/style.css
It would instead
http://domain.com/style.css
This is the problem I was having due to all my CSS and JS being included relativly (Allowing me to change the directory my script is in).
The above adjustment has in fact fixed my original problem, however without the use of PHP may open up an issue for some who want to be able to deploy the scripts and allow them to be fully dynamic without having to edit the base. Good luck!

More efficient ExpressionEngine server moves

I'm trying to find a better way to move my Expression Engine 2 sites from development to live servers. I have a checklist that I go through, starting with running a find and replace for the old/new URLs and server paths, then I update the database config file. This however misses out a huge amount of settings that I then have to go through and change manually, but I don't see why I should need to (unless these are encrypyed somewhere).
For example, I have to change the "Basepath to Template File Directory" in the Global Template Settings manually, along with member settings and a handful of others. There must be a file or entry with these in somewhere that I can change before I upload but I can't find it.
Does anyone know where these are stored?
Those are stored in the database, unless you are using global config variables.
I would highly recommend looking into some sort of config bootstrap. There are quite a few solutions to this, but it's really up to you to pick what's right for your development style / environment(s).
Take a look at the following articles:
http://eeinsider.com/articles/creating-a-robust-config.php-file/
http://boblet.tumblr.com/post/68095239/ee-localhost
http://eeinsider.com/articles/multi-server-setup-for-ee-2/
I've tried those solutions, but in my opinion the best option is NSM config bootstrap.
Check it out here: [http://ee-garage.com/nsm-config-bootstrap][4]
The only thing (currently) missing from these solutions are new config vars regarding file upload paths and locations. You can add those to any of these solutions by adding the variables detailed in this article:
http://expressionengine.com/user_guide/cp/content/files/file_upload_preferences.html#overriding-upload-paths-and-urls-using-configuration-variables
I know I'm late on this one, but for anyone else searching, this plugin is very useful and I have used it on numerous occasions.
ExpressionEngine stores your website URL and Server Path in a ridiculous number of places.
REElocate helps you update these in one simple step.
https://github.com/expressodev/reelocate

Resources