Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2020-03-04 19:50:28

chumby
Member
Registered: 2014-10-23
Posts: 188

Duplicating Page Copy

Hi there,

On my homepage I have Pallet 01 copy (search / browse etc) defind in my Default Album showing up fine in the LHS column.

http://www.tasmanianphotos.com

I would like to use this same Pallet 01 copy om my regular pages (about, contact etc), without having to copy/edit mutlipe blocks of code for each page.

https://www.tasmanianphotos.com/about/   (would like to include the pallet 01 copy from the home page here - wihtout copying and pasting it).

Is there any way I can write a block of code once and use an "include" function in the pallet 01 copy box on other pages so this code is displayed there also?  Therefore for updates I only need to edit one block of code - not multiple?

Cheers,
Chumby.

Offline

#2 2020-03-05 01:19:03

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Duplicating Page Copy

you can do this with phplugins using the pallet01_top hook.
This will put your content in all pages/album/sets using a page template that also uses the function in your phplugins file

function pallet01_top() {
echo'
....your html content.....
';
return false; 
}

This will replace any existing pallet content with your content.
If you want any content that you added individually to pages, templates, albums, or sets to be included, then change return false; to return true;

If you want the content to appear on only certain pages (like Home, About, Contact) but not others, that can be done too.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#3 2020-03-05 01:23:45

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Duplicating Page Copy

rod barbee wrote:

If you want the content to appear on only certain pages (like Home, About, Contact) but not others, that can be done too.

I have an example of doing this over at https://lab.danielleu.com/blog/page-specific-php-code/


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#4 2020-03-05 01:55:41

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Duplicating Page Copy

Daniel, my original thought was to use your code (from this post: http://community.theturninggate.net/vie … 37#p54537) and I actually got that to work.

custom css works too (though Daniel's solution is way cooler)

Wrap the html content in the phplugins function in a div and give it a custom class and also hide it with display:none; using inline css.
Then in the custom css file, use the slug body class to target the custom class on certain pages to set the display to block (display: block !important;)

In phplugins:

function pallet01_top() {
echo'
<div class="special-pallet-content" style="display:none;">
<h2>Special content</h2>
		<p>This is content only inserted into the pallet of certain pages</p>.
</div>
';
return false; 
}

custom css:

.slug-contact .special-pallet-content, .slug-home .special-pallet-content, .slug-about .special-pallet-content {
display: block !important;
}

Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#5 2020-03-05 03:05:25

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Duplicating Page Copy

Rod, I didn't think about CSS at all. Nice to have several ways to get it done.


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#6 2020-03-05 08:08:06

chumby
Member
Registered: 2014-10-23
Posts: 188

Re: Duplicating Page Copy

Hi Rod and Daniel,

Thanks for these answers.

Rod - I like the idea of the CSS solution as I can target different pages.  I have tred your code though and nothing is being displayed in the pallet.  I have set my custom css file up with:


.slug-contact
.special-pallet-content, .slug-home
.special-pallet-content, .slug-about
.special-pallet-content { display: block !important; }

Is that the correct format to target the home and about pages with the html from the php plugins file?

Cheers,
Chumby

Offline

#7 2020-03-05 08:43:52

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Duplicating Page Copy

It's working in your About and Contact pages. You just need the correct slug for your home page.
according to the Home page source code, the selector should be .slug-images


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#8 2020-03-05 09:27:14

chumby
Member
Registered: 2014-10-23
Posts: 188

Re: Duplicating Page Copy

Hi Rod,

Can you see anything in the side menu at https://www.tasmanianphotos.com/about/

I have cleared stored pages through IE and cleared cached templates, but nothing is appearing there for me.

Cheers
Chumby

Offline

#9 2020-03-05 09:35:42

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Duplicating Page Copy

when I look at the mobile size of that page and click the mobile menu button, I see the nav menu and the pallet content added via phplugins.

have you tried looking with other browsers


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#10 2020-03-05 09:38:42

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Duplicating Page Copy

Chumby, I don't see your custom css to make the palette code visible.


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#11 2020-03-05 09:40:38

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Duplicating Page Copy

it's there starting on line 15 of the custom css file (tasmanianphotos.css)


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#12 2020-03-05 09:42:35

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Duplicating Page Copy

here's what I'm seeing on the About page:

desktop

taz-1.jpg

mobile size:

taz-2.jpg


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#13 2020-03-05 09:54:57

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Duplicating Page Copy

rod barbee wrote:

it's there starting on line 15 of the custom css file (tasmanianphotos.css)

not for me... maybe Chumby is doing something.


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#14 2020-03-05 09:59:31

chumby
Member
Registered: 2014-10-23
Posts: 188

Re: Duplicating Page Copy

Thats weird, Rod.

I cannot get that content to show on either Chrome of IE even by clearning out of the cached pages.  Nothing on my phone chrome either.

Hmmm...

Cheers
Chumby

Offline

#15 2020-03-05 10:19:51

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Duplicating Page Copy

And it’s showing up on my iPad for the Contact and About pages. But not the Home page. And the reason for that is the slug for the home page as I mentioned above.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#16 2020-03-05 17:41:52

chumby
Member
Registered: 2014-10-23
Posts: 188

Re: Duplicating Page Copy

Thanks Rod,

All good I can see the column text now. cntrl+shirt+r did the trick.

The only trouble now is my text is not picking up the previous css - ie <p> not working. Margins are also in tight.  Is there something I need to change in my css file to get this format looking ok and as it was?

Cheers,
Chumby

Offline

#17 2020-03-05 22:24:59

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Duplicating Page Copy

Yes. Just add styling to add some left and right padding to the .special-pallet-content div

.special-pallet-content {
	padding: 0 12px;
}

You might also want to change the margin-top of any heading you use. By default, all h elements (h1, h2, etc.) have 3rem of margin-top. for example:

.special-pallet-content h2 {
    margin-top: 1rem;
}

Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#18 2020-03-06 00:51:54

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Duplicating Page Copy

Are you going to expand the site beyond the three pages you already have? If not, then you don't need the css that targets specific pages. Just remove it and also remove the style="display: none;" from the html in the phplugins function.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#19 2020-03-06 09:23:40

chumby
Member
Registered: 2014-10-23
Posts: 188

Re: Duplicating Page Copy

Hi Rod,

Yes trying to get more pages than just the three, eventually wink  So I think this is the way to go.

Have added in that css to my custom file, but I cant see any difference.  Also the <p> tag does seem to be working either (as it did when it was inserted with the other code on the actual pages).  Everything looks scrunched up.

Can you see a margin appearing now?  I have put back in the actual text I need.

Really appreciate the help,

Cheers
Chumby

Offline

#20 2020-03-06 09:45:57

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Duplicating Page Copy

Your html isn't using the class special-pallet-content so there's no surprise that it's not working.

the reason the text is so tight on the left and right is that it hasn't been styled.

wrap all the html you're putting in there in a div and give it a custom class:

<div class="special-pallet-content">

....all your html....

</div>

In your custom css, add that class with some styling:

.special-pallet-content {
padding: 0 12px;
}

that will add 12px left and right padding

You have one div using "align:center"
That is deprecated in html5
instead, use:

<div style ="text-align:center;">
....your content...
</div>

Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#21 2020-03-06 10:02:03

chumby
Member
Registered: 2014-10-23
Posts: 188

Re: Duplicating Page Copy

Thank you so much, Rod.  I will work on your suggestions.

Cheers
Chumby

Offline

#22 2020-03-06 18:28:31

chumby
Member
Registered: 2014-10-23
Posts: 188

Re: Duplicating Page Copy

Hi Rod,

Been messing with this for hours and I cannot get any indent working.

In my php_plugins I have

function pallet01_top() {
echo'

<div class="special-pallet-content">

html content

<div>


';
return false; 
}

and in my css file I have

.special-pallet-content, .slug-home 
.special-pallet-content, .slug-about 
.special-pallet-content, .slug-contact 
.special-pallet-content, .slug-images
.special-pallet-content { 
    display: block !important;
    padding: 0 12px;
}

Can you see what I am doing wrong here?

Cheers
Chumby

Offline

#23 2020-03-06 23:40:57

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Duplicating Page Copy

your custom css does not contain the padding

this is what is currently in your custom css file:

.slug-contact 
.special-pallet-content, .slug-home 
.special-pallet-content, .slug-about 
.special-pallet-content { display: block !important; }

did you upload an updated custom css file?


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#24 2020-03-07 00:02:17

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: Duplicating Page Copy

as a side note, and totally off topic (sorry), I see you're using a custom footer. However, in your phplugins file to implement the footer, you have to divs with the ID of "footer." IDs should only be used once per page

More here on using a custom footer: https://ttg-tips-and-tricks.barbeephoto … -pangolin/

If you have questions about this, go ahead and start a new topic.


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#25 2020-03-07 01:06:02

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Duplicating Page Copy

chumby wrote:

Hi Rod,

Been messing with this for hours and I cannot get any indent working.

In my php_plugins I have

function pallet01_top() {
echo'

<div class="special-pallet-content">

html content

<div>


';
return false; 
}


Can you see what I am doing wrong here?

Cheers
Chumby


The closing div after your html content should be '</div>'.


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

Board footer

Powered by FluxBB