How do I conditionalize a background image?

This forum is for all Flare issues related to PDF, eBook, Microsoft Word, Adobe FrameMaker, XPS, and XHTML book targets.
Post Reply
chuck_agari
Sr. Propeller Head
Posts: 225
Joined: Wed May 30, 2018 2:40 pm

How do I conditionalize a background image?

Post by chuck_agari »

I have a page layout where I want to conditionalize all the images. I was able to successfully do so for the images in the header and footer, but not for the image that I used for the page background.

This is the code:

Code: Select all

<Page Width="800" Height="800" Padding="20px" PageSize="Letter" PageType="first" PaddingLeft="1in" PaddingRight="1in" PaddingTop="1in" PaddingBottom="1in" Orientation="portrait" BleedBottom="0.5in" BleedLeft="0.5in" BleedTop="0.5in" BleedRight="0.5in" BackgroundImage="../Images/Agari_data_swoosh.png" BackgroundRepeat="no-repeat" BackgroundPositionX="0" BackgroundPositionY="bottom">
        <Frame X="-95px" Y="-96px" Width="8.5in" Height="1.385417in" Flow="header" Right="-97px" Bottom="827px" Anchors="">
            <Content>
                <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml">
                    <xhtml:body>
                        <xhtml:img xhtml:src="../Images/Agari_header.png" MadCap:mediastyle="@media print { width: 8.5in;max-width: 8.5in; }" xhtml:style="border-left-style: none;border-left-width: 1px;border-left-color: #f68d39;border-right-style: none;border-right-width: 1px;border-right-color: #f68d39;border-top-style: none;border-top-width: 1px;border-top-color: #f68d39;border-bottom-style: none;border-bottom-width: 1px;border-bottom-color: #f68d39;" MadCap:conditions="Agari.Agari Only" xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" />
                    </xhtml:body>
                </xhtml:html>
            </Content>
        </Frame>
        <Frame X="0px" Y="48px" Width="624px" Height="569px" Flow="body" Right="0px" Bottom="247px" />
        <Frame X="-96px" Y="9.625in" Width="8.5in" Height="0.3541667in" Flow="footer" Right="-96px" Bottom="-94px" Anchors="">
            <Content>
                <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml">
                    <xhtml:body>
                        <xhtml:img xhtml:src="../Images/Agari_footer.png" MadCap:mediastyle="@media print { width: 8.5in;max-width: 8.50in; }" xhtml:style="border-left-style: none;border-left-width: 1px;border-left-color: #f68d39;border-right-style: none;border-right-width: 1px;border-right-color: #f68d39;border-top-style: none;border-top-width: 1px;border-top-color: #f68d39;border-bottom-style: none;border-bottom-width: 1px;border-bottom-color: #f68d39;" MadCap:conditions="Agari.Agari Only" xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" />
                    </xhtml:body>
                </xhtml:html>
            </Content>
        </Frame>
    </Page>
I wasn't able to do this in the Flare UI, so I took a look at the code. the background image is an attribute of the Page element. Because MadCap:conditions is also an applied attribute, I can't just add it ti the Page element. I don't think I can use a span element in an element's attribute list, like this:

Code: Select all

<span MadCap:conditions="Agari.Agari Only">BackgroundImage="../Images/Agari_data_swoosh.png"</span>
Or can I? If not, is there a way to conditionalize the background image in a page layout?
Psider
Propellus Maximus
Posts: 815
Joined: Wed Jul 06, 2011 1:32 am

Re: How do I conditionalize a background image?

Post by Psider »

Yeah, you can't put a span in the attributes as that wouldn't be valid xml.

Thought experiment: mc-conditions in the style attribute?
chuck_agari
Sr. Propeller Head
Posts: 225
Joined: Wed May 30, 2018 2:40 pm

Re: How do I conditionalize a background image?

Post by chuck_agari »

Psider wrote:Yeah, you can't put a span in the attributes as that wouldn't be valid xml.

Thought experiment: mc-conditions in the style attribute?
Sorry, I'm confused. What style attribute?
SteveS
Senior Propellus Maximus
Posts: 2089
Joined: Tue Mar 07, 2006 5:06 pm
Location: Adelaide, far side of the world ( 34°56'0.78\"S 138°46'44.28\"E).
Contact:

Re: How do I conditionalize a background image?

Post by SteveS »

Left field thought...

...apply the condition to the image in the images folder. I seem to recall it worked in an early version of Flare.
Image
Steve
Life's too short for bad coffee, bad chocolate, and bad red wine.
Psider
Propellus Maximus
Posts: 815
Joined: Wed Jul 06, 2011 1:32 am

Re: How do I conditionalize a background image?

Post by Psider »

Psider wrote:Yeah, you can't put a span in the attributes as that wouldn't be valid xml.

Thought experiment: mc-conditions in the style attribute?
Like this. I'm not sure it will work, but it is a valid entry for MC CSS files, so worth a try.

<xhtml:img xhtml:src="../Images/Agari_footer.png" MadCap:mediastyle="@media print { width: 8.5in;max-width: 8.50in; }" xhtml:style="border-left-style: none;border-left-width: 1px;border-left-color: #f68d39;border-right-style: none;border-right-width: 1px;border-right-color: #f68d39;border-top-style: none;border-top-width: 1px;border-top-color: #f68d39;border-bottom-style: none;border-bottom-width: 1px;border-bottom-color: #f68d39; mc-conditions: Agari.Agari Only;" xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" />
chuck_agari
Sr. Propeller Head
Posts: 225
Joined: Wed May 30, 2018 2:40 pm

Re: How do I conditionalize a background image?

Post by chuck_agari »

Psider wrote:
Psider wrote:Yeah, you can't put a span in the attributes as that wouldn't be valid xml.

Thought experiment: mc-conditions in the style attribute?
Like this. I'm not sure it will work, but it is a valid entry for MC CSS files, so worth a try.

<xhtml:img xhtml:src="../Images/Agari_footer.png" MadCap:mediastyle="@media print { width: 8.5in;max-width: 8.50in; }" xhtml:style="border-left-style: none;border-left-width: 1px;border-left-color: #f68d39;border-right-style: none;border-right-width: 1px;border-right-color: #f68d39;border-top-style: none;border-top-width: 1px;border-top-color: #f68d39;border-bottom-style: none;border-bottom-width: 1px;border-bottom-color: #f68d39; mc-conditions: Agari.Agari Only;" xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" />
It is the image in the page element though:

Code: Select all

<Page Width="800" Height="800" Padding="20px" PageSize="Letter" PageType="first" PaddingLeft="1in" PaddingRight="1in" PaddingTop="1in" PaddingBottom="1in" Orientation="portrait" BleedBottom="0.5in" BleedLeft="0.5in" BleedTop="0.5in" BleedRight="0.5in" BackgroundImage="../Images/Agari_data_swoosh.png" BackgroundRepeat="no-repeat" BackgroundPositionX="0" BackgroundPositionY="bottom">
It's the Backgroungimage attribute of the Page element. Nothing to do with the Frame elements.
chuck_agari
Sr. Propeller Head
Posts: 225
Joined: Wed May 30, 2018 2:40 pm

Re: How do I conditionalize a background image?

Post by chuck_agari »

SteveS wrote:Left field thought...

...apply the condition to the image in the images folder. I seem to recall it worked in an early version of Flare.
Bingo!

Thanks.

I will add, however, being bound to source control (GitHub), this process created a .props file that Flare asked to add to source control. I did, not knowing what the correct answer would be and Flare not providing the content experience that would allow confidence that my decision was correct.
Psider
Propellus Maximus
Posts: 815
Joined: Wed Jul 06, 2011 1:32 am

Re: How do I conditionalize a background image?

Post by Psider »

chuck_agari wrote:
It's the Backgroungimage attribute of the Page element. Nothing to do with the Frame elements.
Ah, okay, I thought it was the ones that had the condition applied, but weren't working.
Post Reply