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 2016-03-25 23:45:52

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 178
Website

PHP function help

I have a contact page created using Stage with the grid turned off and the block turned on with the word BLOCK as the only text. The only way to get my content to show is to return TRUE as seen below. Doing this also shows the word BLOCK at the bottom. If I change the return to FALSE the page flashes by. What am I doing wrong? You can visit the page at: https://www.montetrumbull.com/contact/. Thanks!

function ttg_block_top( $style, $path ) {
    if (G_PATH == 'CONTACT') {
        echo '
        <div class="container_12 clearfix">

        <div class="grid_4 gutter_12px collapse clearfix alpha">
        <h4 style="text-align: center;">Monte Trumbull<br>18291 Wagon Trail<br>Buena Vista, CO 81211<br><a href="tel:7192213975">719-221-3975</a></h3>
        <img src="photos/MT-20130918-142504-0079-Glacier-National-Park-Montana-Avalanche-Creek.jpg" width="340" class="alignleft" alt="some descriptive text">
        </div>

        <div class="grid_8 gutter_12px collapse clearfix omega">
            <p style="text-align: justify;">Feel free to contact me using the form below or by calling or emailing me directly. Subscribe to my newsletter or follow me on social media to stay up to date on the latest news from Monte Trumbull Photography.</p>
           
            <iframe height="540" style="border:none; background:transparent; overflow:hidden; width:100%; padding-left:35px;" id="fb_iframe" src="contact/contact.html"></iframe>
        </div>
       
        </div><!-- .container_12 -->
        ';
        return true;
    }
    return true;
}

Offline

#2 2016-03-26 00:52:18

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

Re: PHP function help

which return true; are you referring to?
You've got two of them.

try changing the first return true; to return false;


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 2016-03-26 00:54:01

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 178
Website

Re: PHP function help

Hey Rod. If I change the first one to false, then the page flashes and goes away.

Offline

#4 2016-03-26 01:47:07

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

Re: PHP function help

Ok, I found something that's causing this. There's javascript toward the bottom of the page that hides the block if there's no content. It looks to me that this is what's causing the problem, though I don't know why it would since content is being added.
Here's the script:

    $(document).ready(function(){

        // hide .the-block if it has no content
        function isEmpty(el){
            return $.trim($(el).html());
        }
        //$('.the-block .core div').html(isEmpty('#primary-content').length);
        if(isEmpty('#primary-content').length <= 0 && isEmpty('#secondary-content').length <= 0){
            $('#the-block').hide();
        }
    });
    

I disabled it by commenting it out in the index.php file and the page worked as expected:

/*$(document).ready(function(){

        // hide .the-block if it has no content
        function isEmpty(el){
            return $.trim($(el).html());
        }
        //$('.the-block .core div').html(isEmpty('#primary-content').length);
        if(isEmpty('#primary-content').length <= 0 && isEmpty('#secondary-content').length <= 0){
            $('#the-block').hide();
        }
    });
    */

I thought that this line makes it so the script waits until the page loads before running.

$(document).ready(function(){

Anyway, looks like something for Matt to dive into.


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 2016-03-26 01:51:44

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 178
Website

Re: PHP function help

Thanks Rod! While creating this page in Stage, I tried just pasting the <iframe> in the page copy and it causes LR to go into a loop refreshing. I assume that can't be done?

Monte

Offline

#6 2016-03-26 01:52:45

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

Re: PHP function help

Also, and this doesn't contribute to the problem at hand, your contact info starts with a <h4> tag but is being closed with a </h3> tag.


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

Offline

#7 2016-03-26 01:53:43

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

Re: PHP function help

trummonte wrote:

Thanks Rod! While creating this page in Stage, I tried just pasting the <iframe> in the page copy and it causes LR to go into a loop refreshing. I assume that can't be done?

Monte

I don't know.


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 2016-03-26 01:55:20

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 178
Website

Re: PHP function help

Whoops. Thanks Rod.

Offline

#9 2016-03-26 02:01:44

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

Re: PHP function help

Actually, you might try using the absolute url in the iframe rather than a relative url. I just tried that and it seems to work.


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 2016-03-26 02:16:07

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

Re: PHP function help

this seems to work in the Lightroom Page Copy (md) field:

<div class="container_12 clearfix">
<div class="grid_4 gutter_12px collapse clearfix alpha">
<h4 style="text-align: center;">Monte Trumbull<br>18291 Wagon Trail<br>Buena Vista, CO 81211<br><a href="tel:7192213975">719-221-3975</a></h4>
<img src="photos/MT-20130918-142504-0079-Glacier-National-Park-Montana-Avalanche-Creek.jpg" width="340" class="alignleft" alt="some descriptive text">
</div>
<div class="grid_8 gutter_12px collapse clearfix omega">
<p style="text-align: justify;">Feel free to contact me using the form below or by calling or emailing me directly. Subscribe to my newsletter or follow me on social media to stay up to date on the latest news from Monte Trumbull Photography.</p>
<iframe height="540" style="border:none; background:transparent; overflow:hidden; width:100%; padding-left:35px;" id="fb_iframe" src="https://www.montetrumbull.com/contact/contact/contact.html"></iframe></div>
</div><!-- .container_12 -->

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

Offline

#11 2016-03-26 06:07:59

trummonte
Member
From: Buena Vista, Colorado
Registered: 2012-11-11
Posts: 178
Website

Re: PHP function help

That makes sense. Thanks Rod!

Offline

#12 2016-03-26 06:37:45

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

Re: PHP function help

It's still a mystery to me why the block content gets nuked when using return false; for the ttg_block_top function. Hopefully Matt can shed light on that one.


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 2016-03-26 10:23:56

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: PHP function help

rod barbee wrote:

It's still a mystery to me why the block content gets nuked when using return false; for the ttg_block_top function. Hopefully Matt can shed light on that one.

Not sure. I tried adding it to a page on CampagnaPictures, but didn't see the problem.


Matt

The Turning Gate, http://theturninggate.net

Offline

#14 2016-04-22 05:23:51

AnteroPhotography
Member
Registered: 2014-06-12
Posts: 14

Re: PHP function help

Question - I have a semi-functional TTG site and I'm starting in again after not having worked on it for a few months. I'm trying to add additional pages to it - others that the TTG modules don't make - and get it working. I originally bought into the "PHPlugins GOOD" philosophy, checked enable, and went for it, but of course that meant I couldn't preview locally . . . so I read a book or two and loaded up a full Windows component AMP stack and got all of it working, then started watching tutorials on PHP . . . I think I'm getting lost in overhead that I may not need.

So, my first question is this. Given that I'm overwhelmed in details here, what functionality exactly would I lose if I disabled PHPlugins and re-exported my pages as .htm?

Any help is appreciated. Sarcasm will be forgiven. I don't really know what I'm doing here - I just have a little photography and framing business that needs a working website. My current disaster is anterophotography.com .

Chris

Offline

#15 2016-04-22 05:36:28

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

Re: PHP function help

So, my first question is this. Given that I'm overwhelmed in details here, what functionality exactly would I lose if I disabled PHPlugins and re-exported my pages as .htm?

Only Gallery, CRG, and Stage have the option of being exported as html (and there are other features besides enabling phplugins that will trigger a php export). The others (Pages, Autoindex) will get exported as php. But you don't need phplugins unless you want added functionality like using custom css, drop-down menu navigation, add scripts, google fonts, or any number of customizations.
Matt's got a few examples here:
http://ce4.theturninggate.net/docs/doku … bility_api

But if you don't need any of that, then don't worry about phplugins.

I'm trying to add additional pages to it - others that the TTG modules don't make - and get it working.

how is this going? Do you need any help with this?
If you need additional pages styled like the rest of your site there are easy options including using Stage, Autoindex, or Gallery to create stand-alone pages.
Another options is WordPress. Using Theme for WordPress you can create a blog styled exactly like the rest of your site. You can then create as many pages as you like via WordPress.


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 2016-04-22 07:07:37

AnteroPhotography
Member
Registered: 2014-06-12
Posts: 14

Re: PHP function help

Rod: Thanks, and yes, I do need help. I've gotten way off on a rabbit trail thinking I needed to learn PHP and Javascript and I really don't have the basics down yet. I have the CE4 bundle and Stage freshly downloaded and am re-learning all the panels - the thing I need to do most now is to create a set of pages to go under Classes and Workshops listing our classes and giving times. These are mostly text with a few pictures - easy stuff, if I can get them in the right places and get the links to work. What I have to work with is Dreamweaver CC (and all the other Adobe Suite stuff).

Offline

#17 2016-04-22 07:21:00

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

Re: PHP function help

You can just make the pages you need in Stage using basic html to add images. This will keep the look of your site consistent.

See if this helps: http://ttg-tips-and-tricks.barbeephoto. … lock-text/

this might help too: http://ttg-tips-and-tricks.barbeephoto. … s-ttg-ce4/

and this: http://ttg-tips-and-tricks.barbeephoto. … framework/

Before I created a WordPress site for my workshops, I used Stage or Gallery to create pages for each workshop.
In each case I would just add images inline using html. If I used Gallery for the workshop page I'd also include a gallery of images.

let us know if you need more help when you get to the specifics of creating your pages


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

Offline

Board footer

Powered by FluxBB