Jump to content

data-attributes not showing up in pages using Custom Wrapper


Goza

Recommended Posts

Posted

I made a support ticket #43321 about data-attributes not showing up in pages using custom wrapper. I am very aware any modifications doesn't constitute support, however I thought maybe if using only the default custom wrapper with no changes maybe support is there? Response sent me here 😄 Wondered if anyone had or have this issue or a developer can respond?

https://www.ipsgoza.com/page-builder/  

Using the Page builder all the attributes and the page id will display correctly.

----------------------------------------------------------------------

https://www.ipsgoza.com/non-page-builder/

<!DOCTYPE html>
<html lang="{expression="\IPS\Member::loggedIn()->language()->bcp47()"}" dir="{{if member.language()->isrtl}}rtl{{else}}ltr{{endif}}">
	<head>
		<title>{expression="output.getTitle( $title )"}</title>
		{template="includeMeta" app="core" group="global" location="global" params=""}
		{template="includeCSS" app="core" group="global" location="global" params=""}
	</head>
	<body class="ipsApp ipsApp_front ipsJS_none ipsClearfix ipsLayout_noBackground">
		{$html|raw}
		{template="includeJS" app="core" group="global" location="global" params=""}
	</body>
</html>
  • data-pageapp (not even visible)
  • data-pagemodule (not even visible)
  • data-pagecontroller (not even visible)
  • data-pageid
    • not showing up at all using the default custom wrapper that comes with pages
<!DOCTYPE html>
<html lang="{expression="\IPS\Member::loggedIn()->language()->bcp47()"}" dir="{{if member.language()->isrtl}}rtl{{else}}ltr{{endif}}">
	<head>
		<title>{expression="output.getTitle( $title )"}</title>
		{template="includeMeta" app="core" group="global" location="global" params=""}
		{template="includeCSS" app="core" group="global" location="global" params=""}
	</head>
	<body class='ipsApp ipsApp_front {{if isset( \IPS\Request::i()->cookie['hasJS'] )}}ipsJS_has{{else}}ipsJS_none{{endif}} ipsClearfix{{foreach output.bodyClasses as $class}} {$class}{{endforeach}}' {{if output.globalControllers}}data-controller='{expression="implode( ',', output.globalControllers )"}'{{endif}} {{if isset( output.inlineMessage )}}data-message="{expression="output.inlineMessage"}"{{endif}} data-pageApp='{$location['app']}' data-pageLocation='front' data-pageModule='{$location['module']}' data-pageController='{$location['controller']}' {{if isset( \IPS\Request::i()->id )}}data-pageID='{expression="(int) \IPS\Request::i()->id"}'{{endif}}>
      	{$html|raw}
		{template="includeJS" app="core" group="global" location="global" params=""}
	</body>
</html>
  • data-pageapp (shows but doesn't say "cms")
  • data-pagemodule (shows but doesn't say "pages")
  • data-pagecontroller (shows but doesn't say "page")
  • data-pageid (still doesn't display at all)

This happened to all pages I created that isn't a Page Builder with the Use suite HTML wrapper turned off 

 

https://www.ipsgoza.com/non-page-builder-2/

This page is created with Manual HTML with Use suite HTML wrapper turned on

  • data-pageapp (shows)
  • data-pagemodule (shows)
  • data-pagecontroller (shows)
  • data-pageid (still doesn't display at all)

 

Posted

In your custom template, instead of using $location['x'] use:

  • For app use {expression="\IPS\Dispatcher::i()->application->directory"}
  • For module use {expression="\IPS\Dispatcher::i()->module->key"}
  • For controller use {expression="\IPS\Dispatcher::i()->controller"}

There's not going to be an "id" for most pages, but leave what you have in place - it will apply if you view a database record, for instance.

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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