tx_news n:link don't want build absolute link with config.absPrefix - tx-news

in tx_news template we have <n:link which follow <f:link.typolink seems we can use configuration="{forceAbsoluteUrl: 1}" and get
<h3>
<n:link configuration="{forceAbsoluteUrl: 1}" newsItem="{newsItem}" settings="{settings}" title="{newsItem.title}">
<span itemprop="headline">{newsItem.title}</span>
</n:link>
</h3>
For build absolute link TYPO3 use config.absPrefix but no effect in TYPO3 9.5.3. I can change this settings just in Site Configuration -> Entry Point. But not more in typoscript.
I've checked. This typoscript setting still available in TYPO3 9.5.3. But looks like work just for assets (scripts/styles in header) no more for links? Can i fix that?
In end i need absolute links in tx_news from config.absPrefix or other typoscript but not config.yaml

Try with config.absRefPrefix instead of config.absPrefix

No one solution from typoscript dont work in TYPO3 v9.5.x so I have to use Site manager Variants
rootPageId: 1
base: www.livedomain.com
baseVariants:
-
base: 'http://localhost'
condition: 'applicationContext == "Development"'
-
base: 'https://stagedomain.com'
condition: 'applicationContext == "Testing"'
And in my apache2 or .htaccess
SetEnv TYPO3_CONTEXT Development
or
SetEnv TYPO3_CONTEXT Testing
If context not set website use base url in other cases from baseVariants

Related

Retrive image asset absolute url using Twig in Drupal 8

I am getting the absolute url path for an image using Twig function <{{ url(<'front'>) }}in Drupal 8 and it just works fine. Problem comes when changing the default language (en) to (sp), then the url changes from localhost/themes/.../image.png to localhost/sp/themes/.../image.png and then the image is no longer available. I think there is an option to pass the language as a parameter to the url function, but I'm not quite sure how to implement that.
Many thanks for your help
Update
I have to try this
{{ absolute_url(asset('images/logo.png')) }}
I will test and comment
You could use the twig tweak module and it's file URL function.
{{ 'public://images/logo.png'|file_url(false) }}
You can solve this issue first installing Tweak module in your Drupal installation and using drupal_url Tweak function like this:
{{ drupal_url('<front>', {}, {'language': 'en' }) }}

TYPO3 RTE (htmlarea) - How can I disable options on Link Wizard (mail,file, etc.)

in Backend TYPO3: How can I disable one of these options on RTE (htmlarea), when the editor click on the LINK-Button (anchor). The Link Wizard starts in new window and the editor can choose the link to a page, folder, mail or ext. website.
I want to remove some of these options. Only "Page" and "Mail" will be allowed.
I thought it was on the pageconfig.ts
RTE.default.blindlinkoptions = spec,url
But it doesn't work. Anyone an idea? Thanks.
There it is:
RTE.default.buttons.link.options.removeItems = page,file,url,mail,spec, folder
You could try this:
RTE.default.FE.classesAnchor.default.url >
RTE.default.FE.classesAnchor.default.file >
or this, or both:
RTE.default.FE.classesAnchor := removeFromList(internal-link,
internal-link-new-window, mail)
I'm not so sure about this solutions. I just looked the pathes up in the Backend in the Info module under PageTSConfig.

Create TYPO3 Fluid link for typolink fields generated by a link wizard

I regularly use the link wizard in my TCA.
Its horrible to find out with conditions which kind of link I have to render in Fluid (page/email/external). Is there a solution for this or do I have to create my own ViewHelper?
It seems to be undocumented, but you can pass it to <f:link.page> and it will be rendered correctly, even if it is external, email, or file link. This is because internally, <f:link.page> uses UriBuilder to build the URL, and that UriBuilder uses Typolink.
<f:link.page pageUid="{myLinkFieldValue}">My link</f:link.page>
This is the ViewHelper i´m using for this (+a helper Class):
https://gist.github.com/BenjaminBeck/7220623
I think the link.typolink ViewHelper is what you are looking for, at least for TYPO3 7.0 and above.
<f:link.typolink parameter="{link}">
Linktext
</f:link.typolink>
See Changelog Feature #59396 - TypolinkViewHelper (TYPO3 7.0)
see link.typolink in ViewHelper Reference
External Link --
<f:link.external uri="http://www.typo3.org" target="_blank">external link</f:link.external>
Email --
<f:link.email additionalAttributes="{foo: 'bar'}" email="NULL" class="NULL" dir="NULL" id="NULL" lang="NULL" style="NULL" title="NULL" accesskey="NULL" tabindex="123" onclick="NULL" name="NULL" rel="NULL" rev="NULL" target="NULL">
<!-- tag content - may be ignored! -->
</f:link.email>
Internal Link --
<f:link.page pageUid="1" additionalParams="{extension_key: {foo: 'bar'}}">page link</f:link.page>
In Fluid, there are different link view helpers:
<f:link.action action="show">action link</f:link.action>
<f:link.email email="foo#bar.tld" />
<f:link.external uri="http://www.typo3.org" target="_blank">external link</f:link.external>
<f:link.page>page link</f:link.page>
The Code (and some examples) can be found at: typo3/sysext/fluid/Classes/ViewHelpers/Link

Joomla new version URL not possible with subdirectory?

In my old version of joomla I used "menu-link" and named the subdirectory /xxx/
All the URLs are on that subdirectory also google knows that.
so :
/xxx/jantje
/xxx/pietje
/xxx/enverder
etc.
Now... a new version of Joomla (only "menu-alias" available) and a new website and it is not possible to place that subdirectory in front of all the menu items ... :(
And I dont want the urls to change.
Joomla makes from /xxx/ a name with a dash --> xxx-
so :
xxx-jantje
xxx-pietje
xxx-enverder
Does anybody know how to solve this? I really like the URLS to stay with the subdirectoryname in it.
Thnks in advance!
The problem is solved by :
comment-out the line 95 from: ./libraries/joomla/filter/output.php
//$str = trim(JString::strtolower($str));
and change to:
$str = trim($str);
comment-out the line 370 from: ./libraries/joomla/filter/language.php
//$string = JString::strtolower($string));
Now you can use in the alias also characters like /.

Get Symfony URL relative to the index file

I have a symfony project which, because of DNS issues, is http://<project-name>/ locally, but it needs to be http://<qa-host-name>/<project-name>;/ when hosted in a more QA level environment but it may be http://<domain-name>/ for production (so, I need this to work for both). Now, the images folder will always be relative to the <project-name> directory, so locally it will be http://<project-name>/my-smilie.png and on QA it will be http://<qa-host-name>/<project-name>/my-smilie.png
Since everything is relative to the URL of the index.php, I thought that Symfony would have something to create dynamic URLs which work even if the context is different so that my template.php could have something like
<?php echo image_url("my-smilie.png");
/*see below for potential implementation*/?>
and it would output http://<project-name>/my-smilie.png, http://<qa-host-name>/<project-name>/my-smilie.png, or http://<domain-name>/my-smilie.png. (Relative URLs are fine, but absolute would be better).
Below is an example of what I am looking for, but I feel like I am trying to re-invent the wheel and that Symfony has already accomplished this.
function image_url($img)
{
return get_base_url() . '/images/' . $img;
}
function get_base_url()
{
$par = dirname( $_SERVER[ 'SCRIPT_NAME' ] );
if($par == "/") $par = "";
return $par;
}
try public_path('images/smilie.jpg') function
public_path() manual
I just came across a situation where the public_path helper does not work terribly well, but there is an alternative:
// this populates $host with absolue URL of the parent directory
// of the Symfony script
$host = $request->isSecure()? 'http://':'https://';
$host .= $request->getHost() . $request->getRelativeUrlRoot();

Resources