custom style for layer

Issues related to previewing and publishing your web site.
Post Reply
jimakos
 
 
Posts: 9
Joined: Sat May 26, 2018 11:26 am

custom style for layer

Post by jimakos »

Hello,
In a Layer, after right-clicking and selecting the HTML object, I enter

Code: Select all

<?php echo anim(); ?>
in the custom style field. This custom style is the return from a PHP function - anim().
The page is set to have PHP file extension in page properties.
The PHP file containing the 'anim()' function is included within an HTML script between <head></head> tags.
Something is going wrong, as no custom style is being applied, and even the content (<?php echo anim(); ?>) I'm placing in the custom style field is not present in the PHP file I'm publishing.
Thank you
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: custom style for layer

Post by Pablo »

The custom style section is for adding (inline) style attributes, not for adding PHP code.
jimakos
 
 
Posts: 9
Joined: Sat May 26, 2018 11:26 am

Re: custom style for layer

Post by jimakos »

In WYSIWYG Web Builder 17, it works correctly.
Image
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: custom style for layer

Post by Pablo »

Maybe you have used different HTML output settings?
For example, if you enable 'use external css' then the code may be moved to the external CSS..

Do you have a DEMO project?
viewtopic.php?f=10&t=82134
jimakos
 
 
Posts: 9
Joined: Sat May 26, 2018 11:26 am

Re: custom style for layer

Post by jimakos »

Ηι,
I cloned the page within the same project, and the issue persisted in the published version. The page had a responsive layout, which I deleted, and everything worked fine during publishing. Something seems to be happening when a responsive layout is present.
Thank you
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: custom style for layer

Post by Pablo »

Do you have a DEMO project?
viewtopic.php?f=10&t=82134
jimakos
 
 
Posts: 9
Joined: Sat May 26, 2018 11:26 am

Re: custom style for layer

Post by jimakos »

demo link: http://213.136.75.102/customstyledemo.wbs

The problem is as follows. When we don't have a responsive layout, after clicking "Publish," the custom style appears directly in the PHP or HTML file in the same line as the <div> tag of the layer. Therefore, if the custom style is PHP code, it will execute normally. However, if we have a responsive layout, the custom style, along with the publish action, goes to the corresponding CSS file. That's why, if it's PHP code, it can't execute. It's a simple demo project. We open a page, add a layer, right-click, select custom style, and add something like background-color: #EBEBEB;. Then we right-click and select "page HTML," and we will see <div id="Layer1" style="position:absolute;text-align:left;width:151px;height:75px; background-color: #EBEBEB; background-color: #EBEBEB;">. If we set a breakpoint, e.g., 320px, and click on "page HTML," we will only see <div id="Layer1">; the style is in the page.css file. So, most likely, nothing can be done about this.

Thank you
User avatar
Pablo
 
Posts: 22472
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: custom style for layer

Post by Pablo »

This is normal behavior for responsive layout, because inline styles cannot be responsive.
There is a workaround but this may have other side effects, so use with care:

Tools -> Options -> HTML -> Keep inline style in Responsive Web Design.
jimakos
 
 
Posts: 9
Joined: Sat May 26, 2018 11:26 am

Re: custom style for layer

Post by jimakos »

You have done a great job, thank you very much!
Post Reply