Content container template - standard pages

Matrix Version: Squiz Matrix v6.94.0

Hey everyone,

Has anyone built a CCT for use on standard pages for tables??

I am having trouble adding in the below markup so that our table class is available to editors, rather than them having to remember the table class. The intention is to create a CCT for use on standard pages and create a component for use on content pages.

Markup in paint layout I have is:

<table class="table table-striped" id="table%asset_assetid%">
    <thead>
    <tr>
        <th id="table%asset_assetid%r1c1"></th>
        <th id="table%asset_assetid%r1c2"></th>
        <th id="table%asset_assetid%r1c3"></th>
        <th id="table%asset_assetid%r1c4"></th>
    </tr>
    </thead>
    <tbody>
    <tr>
        <td headers="table%asset_assetid%r1c1">&nbsp;</td>
        <td headers="table%asset_assetid%r1c2">&nbsp;</td>
        <td headers="table%asset_assetid%r1c3">&nbsp;</td>
        <td headers="table%asset_assetid%r1c4">&nbsp;</td>
    </tr>
    </tbody>
</table>

I assume I dont need to use metadata here? I just require the editor to have the ability to add a table within a WYSYWIG and then add and remove columns and rows as per the tool bar functionality within Matrix. Never had this issue before creating CCTs as its asking for metadata to be completed but I dont have a schema for this.

Thanks
Innes

Hi Innes, have you tried Style screen on the design assets? You might not require content template for this.

https://matrix.squiz.net/manuals/designs/chapters/design-asset#Styles-Screen

First up, you can use DXP components on standard pages. If you are creating one for Content pages, then you could likely just reuse that.

But also, if editors are inserting a table using the WYSIWYG tools (included either via the asset_contents keyword, or via a WYSIWYG metadata field), then putting a table into the paint layout will just result in 2 tables.

harinder’s answer is probably best, but, if you want to implement via CCT while still allowing editors to insert tables, I’d suggest using a metadata select field applying a classname to a container. For example:

<div class="%asset_metadata_tableStyle%">%asset_contents%</div>

and for CSS

.table-striped table {

}

Hey Hardiner, hope you are well?

Thanks for this, I had totally forgotten about this and works perfectly in content pages also.

Thanks again
Innes