TYPO3: How can I translate content elements within articles for news? - multilingual

I am using the news extension: news and have enabled the content element rendering for my articles via extension setup (Use content element relation). This works great and redacteurs can use content elements in the news articles, too.
Furthermore I have localized and translated all the articles So if I switch the language in frontend then the translated articles will show up, but the content elements within this translated articles are still in the default language and not translated. So it seems that the translation of the content elements is not working for me.
For this reason I have checked the language of the content elements within the translated articles again, but the language settings of this content elements looks right:
I don't know what I am doing wrong and hope you can help me?
System:
TYPO3 7.6.12
news 4.3.0
UPDATE
I have found the following ticket: https://forge.typo3.org/issues/67905 and I have tried a updated version of the typoscript in this ticket, but it don't work for me, but maybe is this right way to get the content elements translated, too. Any idea?

I have found the solution :). News use RECORDS for content element rendering. So I have to add some typoscript.
setup.txt or setup area
config {
sys_language_overlay = 1
}

Related

I am adding the code in weebly but it dosent show up

Issue with JSON LD CODE
To start with I am trying to use this code in weebly, buy using embed code option and then I click on the edit custom HTML and enter this code. However, after entering this nothing shows up as in the recipe is not shown on the page and a blank page is shown.
this code is picked on schema.org, for recipes.
Could anyone please help me out in what exactly went wrong. I really appreciate your assistance. FYI- I am new to this. I am trying to set up my own food website and and wanted to schema to for SEO improvement. Any other suggestions are welcome. Thanks in advance.
Please refer this link for the JSON-LD CODE. IT WILL BE AT THE END OF THE PAGE. https://schema.org/Recipe
When you add a JSON-LD block in the HTML, it doesn’t change anything visibly on the page. The script element is hidden by default in all browsers, and you typically want to keep it like that (users typically have no interest in your JSON-LD code).
To check if adding the JSON-LD worked correctly, open the page in a browser and check the source code of the page. You should see the script element with your JSON-LD.
You have to add the content (that should be visible to your users) regularly with HTML. The JSON-LD exists next to your content (duplicating the data like name, photo URL etc.), it doesn’t replace your content.

Link to an anchor on another episerver page

Is there an elegant way of linking to anchors in some other page in EpiServer that will keep the links relevant - even after the anchor names change? I am 95% sure there is no standard way of doing this, so thoughts on custom implementations are welcome.
There are existing plugins, but ...
I found this plugin to EpiServer that will basically scrape all the anchors from the page you are interested in, and present them in a drop-down in the TinyMCE wysiwyg editor. But as the anchors have no unique attributes that makes it possible to follow them through changes, these anchor links will rot in time, as changing <a name="Meeting"></a> to <a name="Appointment"></a> will make previously created links invalid.
Thoughts on how this could work
I am not super-familiar with how to easily work with ContentTypes in EpiServer, but I would assume it should be possible to create some kind of property, HtmlAnchors, that would be a collection of strings that could be employed on a page. These would be regarded as constants in practice, and I am quite certain that there is a way in EpiServer of checking if a page property is in use, so if one of these strings (HtmlAnchor) are referenced on some other page, it would be impossible to delete it without removing the references. That would make anchor links always be consistent and referable.
Possible workflow: An editor opens the page property view and presses the + sign on the "HtmlAnchors" property. Adds the string "detailed-overview". A front-ender working with code would then add something like that to the page template:
<h4 name=#Model.Anchors("detailed-overview")>Overview</h4>, and in referring pages use the (as of yet non-existing) url helper #Url.PageLinkWithAnchor(Model.PageLink, "detailed-overview") to create a link to that anchor.
If using a wysiwyg editor then it could use IAnchorPage#Anchors() to list the existing anchors and IAnchorPage#AddAnchor() to add an anchor.
Of course, I see how what I sketched out above seems to rest on a shaky foundation, as it uses simple strings ... which might not really add much else than overhead.

blogger - filtering archive list widget by labels

I have made a blogger site for a friend. She wanted 2 blogs on the one site which I managed to achieve using search and labels.
http://thewishingtreeandotherdreams.blogspot.co.nz/search/label/moon
http://thewishingtreeandotherdreams.blogspot.co.nz/search/label/blog
Now what I want to do is also filter the archive widget based on the above labels.
I know I will have to have a second archive widget so one shows only "moon" labeled posts and the other only shows "blog" labeled posts
My programming knowledge however is VERY limited. Has anyone else already done this. Do you have code you could share with me?
Here's a script with similar functionality but not include nesting by dates. Only copy and edit the next code into new HTML/JavaScript widget.
<script src="http://cloud.github.com/downloads/jhwilson/Create-a-Blogger-archive-page/Make-Blogger-Archive-Page.js"></script>
<script src="http://NAME_OF_YOUR_BLOG.blogspot.com/feeds/posts/default/-/LABEL_NAME?max-results=500&alt=json-in-script&callback=LoadTheArchive"></script>
If adds some CSS could be look better.

Sublime Text 2: Different language highlighting based on context? (a la Webstorm)

I was watching some videos on Egghead.io about AngularJS. The creator of the videos uses Webstorm (and, I believe, works for them). One feature I noticed is that he can set different syntax highlighting within different scopes or quotation marks. So, in code like the following (from an AngularJS directive)
return {
template: '<div>something</div>',
// ^^^ these guys ^^^
}
...he can get the inside of the quotation marks to highlight as HTML.
I use Sublime Text 2, and am fairly wedded to it. Is there an existing feature/plugin for Sublime that could handle a case like this? If not, is something like this technically possible using the Sublime Text 2 API?
I don't think it's built in, but it's certainly possible. I've been doing some work with graphviz and wanted to do something similar. Labels can be generated with html like syntax. Anyways, I played around with the .tmLanguage file and added a new pattern to match the context where html like entries were valid (I look for label = <). The patterns I used for the captures aren't that good, but it works for fine for me. This give me the following, which I think is similar to what you are looking for.
I don't know anything about AngularJS, so I can't help you with anything specific to that, but it is certainly possible. Note that in the image below, the last <table></table> are just to show that highlighting doesn't occur there.
Edit:
Forgot to include this in the original post, but here is my updated tmLangauage file. That first pattern is what I added(link). I used PlistJsonConverter to go from JSON to plist, then saved the file as .tmLanguage. Hope this helps.
#skuroda is right, I implemented #skuroda's code with an additional plugin to easily edit HTML within an AngularJS directive JS file. The result is HTML syntax highlighting within a directive JS file and additional functionality to remove string related delimiters while editing templates.... Sublime AngularJS HTML Template Plugin

How to add a custom field into template.php using Zen sub theme

First time poster here, I'm a designer not skilled at all with php and I have a small issue I don't seem to be able to solve. I'm making a site in drupal 7 using a sub theme on zen.
Btw this is a great CMS, even though people say it's really more a developers CMS. I have no trouble to do what I need using views, rules, display suite etc. So a big thank you for all the developers out there making this such a good CMS. But for this apparently simple problem... no module will help me (I think) and I'm kinda stuck.
So here it is: I'd like to add a subtitle next to the title in all my pages.
So what I did was to add a custom field into the content type basic page (machine name: field_sub_title) which is a simple text field.
I uncommented the following line in my template.php
function mytheme_preprocess_page(&$variables, $hook) {
$variables['sub_title'] = t('field_sub_title');
}
Now my question is how do I load the content of my custom field into that variable?
I know i need to change the second part, but I don't have a clue as into what I need to change this.
Displaying the variable into the the page.tpl.php is something I know about so I only need help with the first part.
{EDIT}
Ok I found how to do this :)
I was looking for a solution in the wrong place. I don't need to change any thing in the template.php file.
Just needed to add this bit of code into my page.tpl.php:
<?php
print $node->field_sub_title['und'][0]['value'];
?>
So I'm posting this here for other Drupal newbies struggling with this....
Your solution may work for now, but there may be a more Drupal-y way to handle a problem like this. If you haven't noticed any problems yet, you may find one or more of the following issues down the road:
Someone who doesn't know php or Drupal theming may need to change the way this works.
If you're like me, you may forget where exactly in code this was implemented.
You may see superfluous markup and/or errors on nodes (content) that do not have this sub-title field (ie. event content not having a sub-title field while basic pages and news articles do).
When you add a field to a content type, it will automatically appear anytime content in that content type is displayed. You should be able to add the sub-title field for your page, event or whatever else you need and have it automatically appear in the markup.
You can 'manage display' of a content type to drag and drop the order for fields to appear. You could take it a step further by using a module like Display Suite to add formatting or layout per-content type.
If you feel like this isn't good enough and the markup for the subtitle must be at the same level as the page title (which is rare), at least add an if statement to make your code check to see if the variable is present before trying to print it. I'd also add a new variable and comments for code readability.
<?php
$subtitle = $node->field_sub_title['und'][0]['value'];
if($subtitle){
print $subtitle;
}
?>
Consider using field_get_items or field_view_value, or at least use the LANGUAGE_NONE constant instead of 'und'
See https://api.drupal.org/api/drupal/modules%21field%21field.module/function/field_get_items/7 and https://api.drupal.org/api/drupal/modules!field!field.module/function/field_view_value/7
This has the added benefit of reducing the number of potential security holes you create.

Resources