Meddysong Posted May 21, 2021 Posted May 21, 2021 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? Jordan Miller 1
Daniel F Posted May 21, 2021 Posted May 21, 2021 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"
Meddysong Posted May 21, 2021 Author Posted May 21, 2021 I'm using a fresh installation of 4.6, @Daniel F: It's also not present on IC's own site:
Daniel F Posted May 21, 2021 Posted May 21, 2021 We're using here a custom template which doesn't have the id included, but I've noticed few issues with the current approach. I've posted an internal bug report for this Jordan Miller, Meddysong and SeNioR- 3
Meddysong Posted May 21, 2021 Author Posted May 21, 2021 36 minutes ago, Daniel F said: I've posted an internal bug report for this Danke/Hvala 🙂 Jordan Miller 1
Meddysong Posted May 21, 2021 Author Posted May 21, 2021 7 hours ago, Meddysong said: I'm using a fresh installation of 4.6, @Daniel F: No, I've got that wrong, @Daniel F: it's a clean installation of 4.5.4.2. The globalTemplate does have the necessary code:
Daniel F Posted May 21, 2021 Posted May 21, 2021 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. Meddysong and Jimi Wikman 1 1
Recommended Posts