Posts: 33
Threads: 1
Joined: Dec 2011
2020-11-06, 09:17:27
(This post was last modified: 2020-11-06, 09:23:56 by vixrealitum.)
hello again! Do any of you have an idea how to add the content of a custom field to another subpage with language support?
Currently, on the index page I have this (and it works without i18n language versions):
Code: <? php get_custom_field ('section1'); ?>
On another page, I drag it through
PHP Code: <? php getPageContent ('index', 'section1');?>
while when I connected the i18n language version, the translation does not change. Regardless of the language, it is always in that first language.
how to do it to detect what language we have and, if there is a second language (en), will replace it as in the example below.
PHP Code: <? php getPageContent ('index_en', 'section1');?>
Or maybe there is some other way to do it? I am waiting for yours suggestions.
best regards.
Posts: 515
Threads: 21
Joined: Feb 2019
Hi vixrealitum,
Yes that would be good to know. I have seen some code about language for this case somewhere.
I will have a look into it and post back.
Posts: 1,928
Threads: 88
Joined: Apr 2010
2020-11-06, 18:39:33
(This post was last modified: 2020-11-06, 19:06:28 by Oleg06.)
I use one code per template for all languages.
Code: <?php get_custom_field('pagetitle'); ?>
https://china-russia.ru/
https://crepemix.ru/
Posts: 33
Threads: 1
Joined: Dec 2011
Oleg, but if you have a section with the same content on 10 pages, you have to fill each subpage with the same content 10 times. I am looking for a more compact solution to fill in one subpage and the rest will be drawn from it and will work with the option of language support.
Posts: 1,928
Threads: 88
Joined: Apr 2010
(2020-11-06, 19:19:06)vixrealitum Wrote: Oleg, but if you have a section with the same content on 10 pages, you have to fill each subpage with the same content 10 times. I am looking for a more compact solution to fill in one subpage and the rest will be drawn from it and will work with the option of language support.
Understood, the difficulties of google translation.
Posts: 1,928
Threads: 88
Joined: Apr 2010
This code works.
Code: <?php getPageField('index_en','pagetitle'); ?>
https://prnt.sc/vekfd8
https://prnt.sc/vekfw8
Posts: 33
Threads: 1
Joined: Dec 2011
2020-11-08, 23:59:28
(This post was last modified: 2020-11-09, 08:30:53 by vixrealitum.)
I found a solution that works on the principle I asked above.
This piece of code is enough..
PHP Code: <?php if ($language == 'pl') { ?><?php getPageContent('index', 'section1');?><?php } ?> <?php if ($language == 'en') { ?><?php getPageContent('index_en', 'section1');?><?php } ?>
The solution allows you to change the content in one place / section and then it can be repeatedly downloaded to different templates. It don't need to edit the same content multiple times on different tabs.
Custom Fields + I18N plugins are required for proper operation.
Posts: 515
Threads: 21
Joined: Feb 2019
Hi vixrealitum,
Code: <?php if ($language == 'pl') {php getPageContent ('index', 'section1');?>
<?php if ($language == 'en') {php getPageContent ('index_en', 'section1');?>
Nice,
Thanks for sharing this solution.
Posts: 33
Threads: 1
Joined: Dec 2011
The "DY Website Custom Fields" plugin should also work similarly (uses 18n custom fields).
It is enough to create 2 fields for each language version and paste the code in a similar way:
PHP Code: <?php if ($language == 'pl') { ?><?php get_website_custom_field('myname-customfield_pl'); ?><?php } ?> <?php if ($language == 'en') { ?><?php get_website_custom_field('myname-customfield_en'); ?><?php } ?>
I hope that someone will find these solutions useful and make it easier to manage the website.
Posts: 1,928
Threads: 88
Joined: Apr 2010
Why are shortcodes not working in fields?
Posts: 9
Threads: 1
Joined: Jan 2016
Is it possible to modify plugin to use codemirror for WYSWIG Editor type field if WYSWIG Editor is disabled by default for whole system in settings?
Posts: 1,928
Threads: 88
Joined: Apr 2010
2022-12-15, 19:17:40
(This post was last modified: 2022-12-15, 19:19:33 by Oleg06.)
Why does the use of html tags lead to such a result when setting fields in the I18N Special Pages plugin,
but to this in the I18N Custom Fields plugin?
Is it possible to somehow fix the plugin I18N Custom Fields?
Posts: 328
Threads: 5
Joined: May 2012
It looks like Special Pages is using "htmlspecialchars" for title/name fields, but Custom Fields is not.
Their setup is a bit different so, not sure how to implement that at the moment, will look at it closer when I get some time, unless anyone else has more experience with that type of thing.
Posts: 116
Threads: 12
Joined: Nov 2014
2023-02-01, 06:20:24
(This post was last modified: 2023-02-02, 06:43:30 by tuxy.)
I added an image-field with the I18N Custom Fields plugin to my pages.
When click on the [browse] button, the file-manager pops-up, but the image-files are not shows up.
For testing: In the default editor, the tool [image] works the file-browser perfect.
When enable debug-mode, this error shows in the filebrowser:
[font=Arial, "Helvetica Neue", Helvetica, sans-serif]Fatal error[/font][font=Arial, "Helvetica Neue", Helvetica, sans-serif]: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /domains/webkust.be/public_html/gscms/plugins/i18n_customfields/browser/filebrowser.php:105 Stack trace: #0 {main} thrown in [/font][font=Arial, "Helvetica Neue", Helvetica, sans-serif]/domains/webkust.be/public_html/gscms/plugins/i18n_customfields/browser/filebrowser.php[/font][font=Arial, "Helvetica Neue", Helvetica, sans-serif] on line [/font][font=Arial, "Helvetica Neue", Helvetica, sans-serif]105[/font]
Someone have also this issue? How can i solve this?
Posts: 116
Threads: 12
Joined: Nov 2014
2023-02-01, 06:32:20
(This post was last modified: 2023-02-02, 06:44:09 by tuxy.)
(2023-02-01, 06:20:24)tuxy Wrote: I added an image-field with the I18N Custom Fields plugin to my pages.
When click on the [browse] button, the file-manager pops-up, but the image-files are not shows up.
For testing: In the default editor, the tool [image] works the file-browser perfect.
When enable debug-mode, this error shows in the filebrowser:
[font=Arial, "Helvetica Neue", Helvetica, sans-serif]Fatal error[/font][font=Arial, "Helvetica Neue", Helvetica, sans-serif]: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /domains/webkust.be/public_html/gscms/plugins/i18n_customfields/browser/filebrowser.php:105 Stack trace: #0 {main} thrown in [/font][font=Arial, "Helvetica Neue", Helvetica, sans-serif]/domains/webkust.be/public_html/gscms/plugins/i18n_customfields/browser/filebrowser.php[/font][font=Arial, "Helvetica Neue", Helvetica, sans-serif] on line [/font][font=Arial, "Helvetica Neue", Helvetica, sans-serif]105[/font]
Someone have also this issue? How can i solve this?
Found it!
Change the code in line 105 in the file ../plugins/i18n_customfields/browser/filebrowser.php :
change this code:
Code: if (count($dirsSorted) != 0) {
with this code:
Code: if (count((array)$dirsSorted) != 0) {
Posts: 3,491
Threads: 106
Joined: Mar 2010
I guess that it's the same issue that we're having with News Manager's filebrowser (that is based on the one in I18N Custom Fields):
http://get-simple.info/forums/showthread...5#pid73355 (includes a suggested fix for GetSimple's subval_sort function, that is the source of the problem)
Posts: 2,094
Threads: 54
Joined: Jan 2011
I18N Custom Fields:
* fixed php8 incompatibility of file and image browsers (page field, image field) - thanks to tuxy for pointing this out
Posts: 116
Threads: 12
Joined: Nov 2014
mvlcek,
With great pleasure, you do really good work, and super fast support.
Did a lot of tests, research and ask a lot of (stupid) questions in this active forum last month, and with the help from the active GS/GS CE-members, i make the disicion switch my blog https://gewoonsimpel.be to GS CE in the next days
Posts: 328
Threads: 5
Joined: May 2012
(2023-02-02, 06:37:31)tuxy Wrote: mvlcek,
With great pleasure, you do really good work, and super fast support.
Did a lot of tests, research and ask a lot of (stupid) questions in this active forum last month, and with the help from the active GS/GS CE-members, i make the disicion switch my blog https://gewoonsimpel.be to GS CE in the next days
Its nice to see the forum coming back to life.
If you questions are getting answers that help, then they aren't any stupid questions.
Cant wait to see your GS version of the site!
Posts: 116
Threads: 12
Joined: Nov 2014
(2023-02-01, 06:20:24)tuxy Wrote: I added an image-field with the I18N Custom Fields plugin to my pages.
When click on the [browse] button, the file-manager pops-up, but the image-files are not shows up.
For testing: In the default editor, the tool [image] works the file-browser perfect.
When enable debug-mode, this error shows in the filebrowser:
[font=Arial, "Helvetica Neue", Helvetica, sans-serif]Fatal error[/font][font=Arial, "Helvetica Neue", Helvetica, sans-serif]: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /domains/webkust.be/public_html/gscms/plugins/i18n_customfields/browser/filebrowser.php:105 Stack trace: #0 {main} thrown in [/font][font=Arial, "Helvetica Neue", Helvetica, sans-serif]/domains/webkust.be/public_html/gscms/plugins/i18n_customfields/browser/filebrowser.php[/font][font=Arial, "Helvetica Neue", Helvetica, sans-serif] on line [/font][font=Arial, "Helvetica Neue", Helvetica, sans-serif]105[/font]
Someone have also this issue? How can i solve this?
(2023-02-02, 06:44:39)islander Wrote: (2023-02-02, 06:37:31)tuxy Wrote: mvlcek,
With great pleasure, you do really good work, and super fast support.
Did a lot of tests, research and ask a lot of (stupid) questions in this active forum last month, and with the help from the active GS/GS CE-members, i make the disicion switch my blog https://gewoonsimpel.be to GS CE in the next days
Its nice to see the forum coming back to life.
If you questions are getting answers that help, then they aren't any stupid questions.
Cant wait to see your GS version of the site!
Yes, i learn a lot from the forum, reading about some things are solved, code-snippets, and so on. It's a paradise for devs/webdesigners and users ;-)
When the website is integrated with GS, i posted in the forum!
After see the possibilities and how flexible GS CE is with the help of the plugin repo, thinking also move a bigger project ( https://dogvalley.be/) and try rebuild with GS CE :-)
Posts: 35
Threads: 2
Joined: Jan 2013
(2012-04-20, 14:15:35)andyash Wrote: mvlcek Wrote:global $SITEURL;
... echo substr($item->link,0,strlen($SITEURL)) == $SITEURL ? '_self' : '_blank'; ... mvlcek Wrote:<a href="<?php echo htmlspecialchars($item->link); ?>" target="_<?php if($item->link!=='') { echo 'blank'; } else {echo 'self'; } ?>">
How and where do I put these two to achieve my target?
I need to know how to do this, as well.
...lee
|