xoops forums

aerograf

Quite a regular
Posted on: 2017/6/6 17:58
aerograf
aerograf (Show more)
Quite a regular
Posts: 204
Since: 2017/1/7 1
#1

Language in js

Tell me please, how best to connect language constants to the js script?
It is necessary to localize the script.
Thank you in advance,

geekwright

Quite a regular
Posted on: 2017/6/6 18:51
geekwright
geekwright (Show more)
Quite a regular
Posts: 283
Since: 2010/10/15
#2

Re: Language in js

There are several ways you might accomplish this, depending on the exact requirements.

Here is an example from XOOPS 2.5.9, where the image manager code sets up to use the fine-uploader javascript. To do this, we used javascript in a script tag in a Smarty template to initialize the library code, passing in all the required language constants. In the template we can use the language constants as normal -- Smarty will do the substitution in the script code just like it will in HTML.

See the code here, on GitHub:
https://github.com/geekwright/XoopsCor ... tem_imagemanager2.tpl#L52

aerograf

Quite a regular
Posted on: 2017/6/6 19:25
aerograf
aerograf (Show more)
Quite a regular
Posts: 204
Since: 2017/1/7 1
#3

Re: Language in js

I thought about how to connect language files and pull data out of them. Smarty does not work.
To make separate files which then to translate - I think not an option and there is a decision much easier.
All for the user

aerograf

Quite a regular
Posted on: 2017/6/16 13:09
aerograf
aerograf (Show more)
Quite a regular
Posts: 204
Since: 2017/1/7 1
#4

Setting the block

Dear forum users.
With the previous question figured out.
Tell me, is it possible to change the style, visibility of one (not all blocks) of a specific block from the left or right without affecting the main css files?

Bleekk

Theme Designer
Posted on: 2017/6/16 16:34
Bleekk
Bleekk (Show more)
Theme Designer
Posts: 934
Since: 2002/12/14
#5

Re: Setting the block

Yes it is possible.
But you need css to change it. If you do not want to change the main css File, You can add the css into your theme.html.

You can add a css class to your blocks using for example the block id.
class="block-<{block.id} >"

And when you know the id of the block you want to change then add a css style for it like
.block-4{background#c3c3c3}

This will not affect other blocks

aerograf

Quite a regular
Posted on: 2017/6/16 16:45
aerograf
aerograf (Show more)
Quite a regular
Posts: 204
Since: 2017/1/7 1
#6

Re: Setting the block

I know this option. The question concerns to the concrete module. I can not know what ID it will be assigned to in the future, and what topic will be.
Is it possible to change the appearance, size, etc.? By adding styles to xoops_version.php or configuring the blocks in the _show ($ options) function or something else?
It is in a single module.

Bleekk

Theme Designer
Posted on: 2017/6/16 17:54
Bleekk
Bleekk (Show more)
Theme Designer
Posts: 934
Since: 2002/12/14
#7

Re: Setting the block

You can add the class in the name of the Blocks.
Name your block like "blue|block-title"
Then use a .blue class in the css.
In the template you need to work with smarty to check if the title has a | in it and then use first Part as css class and second as the title

aerograf

Quite a regular
Posted on: 2017/6/16 19:37
aerograf
aerograf (Show more)
Quite a regular
Posts: 204
Since: 2017/1/7 1
#8

Re: Setting the block

Thanks, I'll try.
p.s. I tried it. Valid only for content in the block. But the system itself does not change ...
Maybe some other ideas?
And if not, how can you make a global link from the module, that would be possible to install all the modules? (Management via admin panel is planned)

Bleekk

Theme Designer
Posted on: 2017/6/17 7:05
Bleekk
Bleekk (Show more)
Theme Designer
Posts: 934
Since: 2002/12/14
#9

Re: Setting the block

No, it is not only valid for content of the block, it is valid for all html that is inside the foreach loop of the blocks.

aerograf

Quite a regular
Posted on: 2017/6/17 8:07
aerograf
aerograf (Show more)
Quite a regular
Posts: 204
Since: 2017/1/7 1
#10

Re: Setting the block

Maybe.
I'll try again, in more detail.
Thank you,