Jump to content

Adding custom block areas in templates


snugRugBug

Recommended Posts

I'm trying to figure out how I can add additional block areas to my templates. At the moment, I'm in the global template of the core applications. This is the relevant part of my globalTemplate.phtml file, unaltered:

<main role='main' id='ipsLayout_body' class='ipsLayout_container'>
			<div id='ipsLayout_contentArea'>
				<div class='preContentPadding'>
                  {template="ipsfocus_backgroundPicker" if="theme.ipsf_backgroundType == 'ipsfocus_backgroundPicker'" app="core" group="global" params=""}
                  {template="ipsfocus_countdown" if="theme.ipsf_countdown" app="core" group="global" params=""}
                  {{if !in_array('ipsLayout_minimal', \IPS\Output::i()->bodyClasses )}}{{if !member.member_id}}{template="ipsfocus_guestMessage" if="theme.ipsf_guest" app="core" group="global" params=""}{{endif}}{{endif}}
              <!-- TEST FOR FULL WIDTH PRE-CONTENT -->
                   
              <!-- TEST FOR FULL WIDTH PRE-CONTENT END -->
              </div>
				<div id='ipsLayout_contentWrapper'>
					{template="sidebar" if="theme.sidebar_position == 'left'" app="core" group="global" params="'left'"}
					<div id='ipsLayout_mainArea'>
						<a id='elContent'></a>
						{advertisement="ad_global_header"}
						{template="acknowledgeWarning" if="\IPS\Member::loggedIn()->members_bitoptions['unacknowledged_warnings']" params="\IPS\Member::loggedIn()->warnings( 1, FALSE )" group="global" app="core"}
						{template="widgetContainer" group="global" app="core" params="'header', 'horizontal'"}
						{$html|raw}
						{template="widgetContainer" group="global" app="core" params="'footer', 'horizontal'"}
						{advertisement="ad_global_footer"}
					</div>
					{template="sidebar" if="theme.sidebar_position == 'right'" app="core" group="global" params="'right'"}
				</div>
			</div>
			{template="inlineMessage" if="member.msg_show_notification and $conversation = \IPS\core\Messenger\Conversation::latestUnreadConversation()" app="core" group="global" params="$conversation->comments( 1, 0, 'date', 'desc' )"}
		</main>

What I want is a block area as the first child of the #ipsLayout_contentWrapper div . I want this block area to be full width. First I tried moving

{template="widgetContainer" group="global" app="core" params="'header', 'horizontal'"}

to the desired position, which results in this code:

<div id='ipsLayout_contentWrapper'>
    <!-- New position -->
	{template="widgetContainer" group="global" app="core" params="'header', 'horizontal'"}
	 <!-- New position -->
	{template="sidebar" if="theme.sidebar_position == 'left'" app="core" group="global" params="'left'"}
	<div id='ipsLayout_mainArea'>
		<a id='elContent'></a>
			{advertisement="ad_global_header"}
			{template="acknowledgeWarning" if="\IPS\Member::loggedIn()->members_bitoptions['unacknowledged_warnings']" params="\IPS\Member::loggedIn()->warnings( 1, FALSE )" group="global" app="core"}
			<!-- Original position -->		
			{$html|raw}
			{template="widgetContainer" group="global" app="core" params="'footer', 'horizontal'"}
        	{advertisement="ad_global_footer"}
	</div>
	{template="sidebar" if="theme.sidebar_position == 'right'" app="core" group="global" params="'right'"}
</div>

This works fine, except for the fact that I would actually still like to have a block area in the original position. This means that I have to add an additional block area in my template. This is where things get a little wonky.

Using the same block area template tag in both positions does not work, since the first parameter taken by the tag is an id, which has to be unique. If 2 block areas have the same id, they will always have the same block assigned, which is no good.

The next thing I try is to simply change the id of my custom block area. At first it seems to work fine: I'm able to drag a block into the area, configure it, and see the correct results, but as soon as I refresh the page, the custom block is gone.

And this is where I have become stuck. I suspect that I will have to update some configuration in the database in order to allow for more custom block areas, and right now I'm looking for it.

I'm hoping someone could help me find a way to make the block area configuration stick around permanently.

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

ips 4 use specific code for theme change this sidebar to

 

{template="sidebar" if="theme.sidebar_position == 'right'" app="core" group="global" params="'left'"}

for sidebar in left because if you see theme you find html=ltr or rtl 

ltr=left to right  or rtl=right to left

 

i have same problem with template because page builder use id mainarea for content of page if you create html page menu to drop block don't work...

 

support don't understand the problem.... it's very simply to change in the futur update  content  for page builder  in id=content wrapper no??

Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

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