Adding a new template position to Cassiopeia Topic is solved

Everything to do with Joomla! 4.x templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
DJBenz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 184
Joined: Tue Jan 20, 2009 8:34 am
Contact:

Adding a new template position to Cassiopeia

Post by DJBenz » Wed Jan 31, 2024 6:56 pm

I want to add a new position to Joomla 4 Casseopeia Template because I have filled bottom-a and bottom-b with two modules each and adding a third squeezes them too much horizontally.

So if I want to add bottom-c how do I go about it?

I tried duplicating the code in index.php to simply add another instance thus:

Code: Select all

<?php if ($this->countModules('bottom-a', true)) : ?>
        <div class="grid-child container-bottom-a">
            <jdoc:include type="modules" name="bottom-a" style="card" />
        </div>
        <?php endif; ?>

        <?php if ($this->countModules('bottom-b', true)) : ?>
        <div class="grid-child container-bottom-b">
        <jdoc:include type="modules" name="bottom-b" style="card" />
        </div>
        <?php endif; ?>
        
        #ADDED CODE
        <?php if ($this->countModules('bottom-c', true)) : ?>
        <div class="grid-child container-bottom-c">
        <jdoc:include type="modules" name="bottom-c" style="card" />
        </div>
        #ADDED CODE
        <?php endif; ?>    
Then adding to templateDetails.xml

Code: Select all

<position>bottom-a</position>
	<position>bottom-b</position>
	#ADDED CODE
	<position>bottom-c</position>
	#ADDED CODE
        <position>footer</position>
	<position>debug</position>
But when I assign the position bottom-c to my module it appears somewhere at the left between Banner and Top-A so I guess I did something wrong.

Is there a simple way to do what I want and add this position? I'm not great with digging into code, so explain in simple terms please! :laugh:
Last edited by toivo on Fri Feb 09, 2024 10:45 am, edited 1 time in total.
Reason: mod note: typo in subject

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1659
Joined: Tue Jun 30, 2020 12:17 pm

Re: Adding a new template position to Casseopeia

Post by Pavel-ww » Thu Feb 01, 2024 8:10 am

DJBenz wrote:
Wed Jan 31, 2024 6:56 pm
...and adding a third squeezes them too much horizontally.
Hi. I think you are too complicated. To solve this problem is not required to make an override. Only CSS is enough
DJBenz wrote:
Wed Jan 31, 2024 6:56 pm
But when I assign the position bottom-c to my module it appears somewhere at the left between Banner and Top-A so I guess I did something wrong.
Nevertheless ... this is because you placed the module position not in the right place of the HTML marking. You need to study the HTML layout and its CSS properties. Then make a decision on placing a position in the right place of markings.
Last edited by Pavel-ww on Thu Feb 01, 2024 8:16 am, edited 1 time in total.

DJBenz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 184
Joined: Tue Jan 20, 2009 8:34 am
Contact:

Re: Adding a new template position to Casseopeia

Post by DJBenz » Thu Feb 01, 2024 8:14 am

Pavel-ww wrote:
Thu Feb 01, 2024 8:10 am
DJBenz wrote:
Wed Jan 31, 2024 6:56 pm
...and adding a third squeezes them too much horizontally.
Hi. I think you are too complicated. To solve this problem is not required to make an override. Only CSS is enough
That would be fantastic if I could, but how? My CSS knowledge is weak and it usually takes me many attempts to change even the simplest things! :(

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1659
Joined: Tue Jun 30, 2020 12:17 pm

Re: Adding a new template position to Casseopeia

Post by Pavel-ww » Thu Feb 01, 2024 8:20 am

DJBenz wrote:
Thu Feb 01, 2024 8:14 am
That would be fantastic if I could, but how? My CSS knowledge is weak and it usually takes me many attempts to change even the simplest things! :(
Even to make a decision on placing a position in the PHP code, you need CSS knowledge ... Provide a link to your site where there are squeezes modules in bottom-b position and I can help you with CSS

DJBenz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 184
Joined: Tue Jan 20, 2009 8:34 am
Contact:

Re: Adding a new template position to Casseopeia

Post by DJBenz » Thu Feb 01, 2024 8:31 am

Pavel-ww wrote:
Thu Feb 01, 2024 8:20 am
Even to make a decision on placing a position in the PHP code, you need CSS knowledge ... Provide a link to your site where there are squeezes modules in bottom-b position and I can help you with CSS
Ah sorry Pavel, I'm working on a Xampp server at the moment so I can't provide a link. I wanted to try out my changes in a development environment before I move to my live site.

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1659
Joined: Tue Jun 30, 2020 12:17 pm

Re: Adding a new template position to Casseopeia

Post by Pavel-ww » Thu Feb 01, 2024 8:39 am

DJBenz wrote:
Thu Feb 01, 2024 8:31 am
Ah sorry Pavel, I'm working on a Xampp server at the moment so I can't provide a link. I wanted to try out my changes in a development environment before I move to my live site.
If you do not have enough knowledge and want to receive help, it is better to conduct development at a real hosting so that you can provide a link and not take care of the server settings. Things as XAMPP are designed for experienced users

DJBenz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 184
Joined: Tue Jan 20, 2009 8:34 am
Contact:

Re: Adding a new template position to Casseopeia

Post by DJBenz » Thu Feb 01, 2024 8:43 am

Pavel-ww wrote:
Thu Feb 01, 2024 8:39 am
If you do not have enough knowledge and want to receive help, it is better to conduct development at a real hosting so that you can provide a link and not take care of the server settings. Things as XAMPP are designed for experienced users
:) I'll come back with a link when I have updated the live site. I am in the final stages anyway so the last modifications are only fine tuning to get the site exactly how I want it.

DJBenz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 184
Joined: Tue Jan 20, 2009 8:34 am
Contact:

Re: Adding a new template position to Casseopeia

Post by DJBenz » Fri Feb 09, 2024 10:20 am

Pavel-ww wrote:
Thu Feb 01, 2024 8:39 am
If you do not have enough knowledge and want to receive help, it is better to conduct development at a real hosting so that you can provide a link and not take care of the server settings. Things as XAMPP are designed for experienced users
Hi Pavel,

Here's a link in a live server environment. :)

Image

So I have two modules in bottom-a and two in bottom-b. If I add another module of the same type then it squeezes them up so I have three modules in a row. How can I get a new row within either position so I would have:

Code: Select all

BOTTOM-A [MODULE][MODULE]
         [MODULE]
Instead of:

Code: Select all

BOTTOM-A [MODULE][MODULE][MODULE]
???

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1659
Joined: Tue Jun 30, 2020 12:17 pm

Re: Adding a new template position to Casseopeia

Post by Pavel-ww » Fri Feb 09, 2024 10:47 am

DJBenz wrote:
Fri Feb 09, 2024 10:20 am

Code: Select all

BOTTOM-A [MODULE][MODULE]
         [MODULE]
Hi. Here is for bottom-a

Code: Select all

.container-bottom-a {
    flex-wrap: wrap;
}
.container-bottom-a>* {
    flex: 0 0 calc(50% - .5em);
}
2.jpg
Here is for bottom-a + bottom-b if you need

Code: Select all

.container-bottom-a,
.container-bottom-b {
    flex-wrap: wrap;
}
.container-bottom-a>*,
.container-bottom-b>* {
    flex: 0 0 calc(50% - .5em);
}
You do not have the required permissions to view the files attached to this post.

DJBenz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 184
Joined: Tue Jan 20, 2009 8:34 am
Contact:

Re: Adding a new template position to Casseopeia

Post by DJBenz » Fri Feb 09, 2024 11:50 am

Pavel-ww wrote:
Fri Feb 09, 2024 10:47 am
Here is for bottom-a + bottom-b if you need
That is perfect, thank you so much! I added the code for bottom-a and bottom-b in case I need to use extra rows in either position in future.

DJBenz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 184
Joined: Tue Jan 20, 2009 8:34 am
Contact:

Re: Adding a new template position to Casseopeia

Post by DJBenz » Fri Feb 09, 2024 5:36 pm

Pavel-ww wrote:
Fri Feb 09, 2024 10:47 am

Code: Select all

.container-bottom-a,
.container-bottom-b {
    flex-wrap: wrap;
}
.container-bottom-a>*,
.container-bottom-b>* {
    flex: 0 0 calc(50% - .5em);
}
Hi Pavel,

This worked perfectly on desktop, although on mobile it's not so great:

Image Image

There's also a lot of white space between the modules in main-top position and bottom-a, and there's such a huge white space after bottom-b up to the footer that I can't even capture it on a screenshot!

User avatar
Pavel-ww
Joomla! Ace
Joomla! Ace
Posts: 1659
Joined: Tue Jun 30, 2020 12:17 pm

Re: Adding a new template position to Casseopeia

Post by Pavel-ww » Sat Feb 10, 2024 8:28 am

DJBenz wrote:
Fri Feb 09, 2024 5:36 pm
This worked perfectly on desktop, although on mobile it's not so great:
Hi. Here is for mobile

Code: Select all

@media (max-width: 991.98px) {
    .container-bottom-a>*,
    .container-bottom-b>* {
        flex: 0 1 auto;
    }
}

DJBenz
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 184
Joined: Tue Jan 20, 2009 8:34 am
Contact:

Re: Adding a new template position to Casseopeia

Post by DJBenz » Sat Feb 10, 2024 9:45 am

Pavel-ww wrote:
Sat Feb 10, 2024 8:28 am
DJBenz wrote:
Fri Feb 09, 2024 5:36 pm
This worked perfectly on desktop, although on mobile it's not so great:
Hi. Here is for mobile
Do I need to say it? Perfect again, but you know that. Thank you!


Post Reply

Return to “Templates for Joomla! 4.x”