Jump to content

Recommended Posts

Posted

I'm sure this used to be a feature which I've used before but I can't see it now ...

I'd like to target specific pages with CSS. That's normally not a problem for the different views offered on the various IC apps because the data attributes present in the body tag allow some very precise targetting.

That doesn't appear to be case with Pages, where the data attributes are limited to the generic

data-pageapp="cms" data-pagelocation="front" data-pagemodule="pages" data-pagecontroller="page"

and don't include a specific way of targetting a page via its id number. I'm sure I've used data-pageid before.

Could you please add or bring back this feature?

Posted

Is your globalTemplate customised? It's already there:

{{if isset( \IPS\Request::i()->id )}}data-pageID='{expression="(int) \IPS\Request::i()->id"}'{{endif}}

My demo board output:

body class="ipsApp ipsApp_front ipsJS_has ipsClearfix cCmsDatabase_articles" data-controller="core.front.core.app,core.front.widgets.manager"  data-message=""  data-pageapp="cms" data-pagelocation="front" data-pagemodule="pages" data-pagecontroller="page" data-pageid="7"   data-pagename="articles.html"

 

Posted

Yea, even if the code is present, it won't run if Request->id isn't present:)
 

To give you more insight, that's my bug report from today morning:

Quote

Our current globalTemplate body element contains following code:

{{if isset( \IPS\Request::i()->id )}}data-pageID='{expression="(int) \IPS\Request::i()->id"}'{{endif}}

The problem with this approach is that Request->id is not always present, for example sometimes we're using a different param name for the primary item like page_id instead of only id, in other cases we have only a string which we use to fetch the record or page based on the path so it's again not setting the Request::I()->id resulting in the missing pageID parameter.

I guess it would be a better approach to set this programatically when needed.

 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...