News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

TinyPortal

Started by lurkalot, February 12, 2005, 04:43:00 AM

Previous topic - Next topic

jsx

The user added photos in the post, the photo under the photo without spaces. His article was added to the home page of the portal. I edited this post and separated the links from each other so that the gaps between the photos were kept. And unfortunately in this article the photos are still displayed without spacing on the home page of the portal. I cleared the forum cache and it doesn't work. I am using TP 2.0 in the forum, everything was fine on earlier TP versions.

lurkalot

Quote from: jsx on November 22, 2020, 01:31:54 PM
The user added photos in the post, the photo under the photo without spaces. His article was added to the home page of the portal. I edited this post and separated the links from each other so that the gaps between the photos were kept. And unfortunately in this article the photos are still displayed without spacing on the home page of the portal. I cleared the forum cache and it doesn't work. I am using TP 2.0 in the forum, everything was fine on earlier TP versions.

Sorry for delay in responding. 

What front page settings are you using? and what version of SMF? just so we can check.  A link to the page would also be handy, via PM if you don't want it posted here.

jsx

Quote from: lurkalot on November 23, 2020, 02:23:34 AM
What front page settings are you using? and what version of SMF? just so we can check.  A link to the page would also be handy, via PM if you don't want it posted here.

You mean this setting? I use this setting:

What to display on frontpage: Promoted topics + articles - sorted on date

The forum runs on SMF 2.0.17

I sent you a private message.

jsx

Could it be possible to insert the code from this modification into the TinyPortal block?

Google Translate for SMF 2.0

https://custom.simplemachines.org/mods/index.php?mod=3213

// Google Translate Mod
if (!empty($modSettings['enable_google_translate']))
{
echo '
<table border="0" width="100%" height="55px">
<tr>
<td>
<div align="' . $modSettings['google_translate_location'] . '"><div id="google_translate_element"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
pageLanguage: \''. $modSettings['google_translate_language'] . '\',
autoDisplay: \'' . $modSettings['google_translate_autodisplay'] . '\',
multilanguagePage: \'' . $modSettings['google_translate_multilanguage'] . '\',
gaTrack: \'' . $modSettings['google_translate_analytics'] . '\',
gaId: \'' . $modSettings['google_translate_analytics_id'] . '\',
layout: google.translate.TranslateElement.InlineLayout.' . $modSettings['google_translate_style'] . '
  }, \'google_translate_element\');
}
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></div><br />
</td>
</tr>
</table>';
}

@rjen

Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

jsx

Yes, but this menu does not appear in the block. The block is empty. When PHP block type is set. When I set the type of HTML & JavaScript block, only this is displayed in the block:

// Google Translate Mod if (!empty($modSettings['enable_google_translate'])) { echo '

'; }



@rjen

What kind of block did you try? I should be php...

May need some variables set...
I can have a look at it tonight
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

jsx

When PHP block type is set then the block is empty. Translator is not displayed.

It would be nice if you could help me with that.

@rjen

Just to be sure. Did you actually install the mod? The code you provided looks for the enable_google_translate setting, so you will still need to install that mod for the code to work!

Perhaps you can explain what you want to accomplish... because there may be easier ways than trying to implement half a mod in a block.
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

jsx

Yes, the modification is installed. When installing this modification, I was informed that this code must be added to the index.template.php file for the theme I'm using.

I would like a Google translator to be embedded in the TP block.

I mean it:


lurkalot

Quote from: jsx on December 20, 2020, 05:36:01 AM
Yes, the modification is installed. When installing this modification, I was informed that this code must be added to the index.template.php file for the theme I'm using.

I would like a Google translator to be embedded in the TP block.

I mean it:



Then you don't need a mod at all, just add the google translate code to a html block,

<div id="google_translate_element3"></div>

<script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script>

<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

@rjen

Thats what I thought
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

jsx

@lurkalot

Thanks for your help, but after adding this code to the HTML & Javascript block, the google translate does not display. The block is empty.

lurkalot

Quote from: jsx on December 20, 2020, 03:22:36 PM
@lurkalot

Thanks for your help, but after adding this code to the HTML & Javascript block, the google translate does not display. The block is empty.

Using the code I posted?  Strange it works fine on all my sites.  :o

jsx

Quote from: lurkalot on December 20, 2020, 03:46:41 PM
Quote from: jsx on December 20, 2020, 03:22:36 PM
@lurkalot

Thanks for your help, but after adding this code to the HTML & Javascript block, the google translate does not display. The block is empty.

Using the code I posted?  Strange it works fine on all my sites.  :o

Yes, I used this code. For me it is also strange.

@rjen

Try this...


<center><div id="google_translate_element" style="height:50px; overflow:hidden"></div><script>
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: 'en'
  }, 'google_translate_element');
}
</script><script src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script></center>
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

jsx

@rjen

Thanks for the code, this code works, the google translate is displayed. However, I have to use this modification because in the modification I can set the language that is used in the forum and I can enable the function: Automatically display the translation banner.

@lurkalot, @rjen

Thanks for the help. :)

@rjen

You set the language in the code: change language: 'en' to your language.

What does 'automatically show the translation banner' do ?
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

jsx

Thanks for the tip.

Quote from: @rjen on December 21, 2020, 02:34:29 AM
What does 'automatically show the translation banner' do ?

I thought this was the function that displayed this banner:



But that's not it. I turned off this function and after entering the forum a banner from Google Translate appears (the one from the screen).

Google Chrome and Microsoft Edge automatically propose to translate the page content into the language used by the browser. So this modification that I have installed is unnecessary. But thank you for the code you gave me, because eg Opera does not offer to translate the content of the page, so embedded translator in the menu block is needed, always someone can manually choose to translate the content.

Would it be possible to change the style of Google Translate in the code to a drop-down menu that can be selected in this modification? Could you give me a code for this style of Google Translate?


Nodaz

why do i keep getting notification of unread post for this topic?
I cannot figure out how to turn that off, its not listed anywhere in my notifivcation settings or otherwise

Advertisement: