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.
You are not logged in.
Pages: 1
A Non-Backlight part of my website has pages where I use what's known as "PHP Include" which is a line of code pointing to content that can be integrated across more than one page, such as a table with dates, and such.
Instead of having to modify several documents with the same table content, from page to page — which can be very time consuming, let alone leaving a huge potential to create errors, omissions, and conflicting information — it's great to modify a single "PHP Include" document that updates all pages that point to it.
The line of code I use looks something like this:
<?php include("pho105_announce.php"); ?>
I'm just curious to ask if Backlight supports anything similar that I can use in more than one of my backlight/custom/phplugins documents to use the same tabled content? I tried integrating that line of code noted above, but no luck in generating anything in a web browser, even by using various iterations of "../../" in the doc name.
Thanks for giving this any thought...
Don
Quatrain ƒotographic, LLC
…seeing, thinking, teaching. Visual Poetry.
https://quatrainfotographic.com
Offline
have you tried using an absolute url to the 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
I did a little test and it works for me. Did you get any errors? I put my test file in /backlight/custom/phplugins and tried with following two versions of using include:
// v1
include("dlp_common.php");
//v2
include(realpath(BACKLIGHT_HOOK) . "/custom/phplugins/dlp_common.php");
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
Hi Rod & Daniel,
Sorry for the late reply. Been pre-occupied with other projects.
Unfortunately none of those solutions work on my end, but then, I might very well be placing your suggested code solutions in the wrong place, or the wrong way. I'm clearly missing something to understand how to integrate it.
Thanks very much for giving this your time & effort.
I'm moving on to some other aspects of the site build.
Don
Quatrain ƒotographic, LLC
…seeing, thinking, teaching. Visual Poetry.
https://quatrainfotographic.com
Offline
DonWa2,
You should be able to use any valid PHP in PHPlugins files. If you're attempting to add PHP to the page content through Backlight's admin, that's not going to work.
Offline
DonWa2,
You should be able to use any valid PHP in PHPlugins files. If you're attempting to add PHP to the page content through Backlight's admin, that's not going to work.
Didn't think of that... most likely that's the culprit.
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
Thanks all for the replies on this...
@Daniel
I am indeed trying to use *includes* via the phplugins folder [not via Backlight admin]. I created a designated php file with content, and uploaded that doc inside of the phplugins folder, then pointed the suggested code in the document I want it to appear in.
Tried this:
include("winter_dates.php");
and this iteration:
<?php include("winter_dates.php"); ?>
I tried the more elaborate *//v2* line of code as well, with no luck.
I got nothing to appear.
Sorry for my confusion and misunderstanding.
Don
Quatrain ƒotographic, LLC
…seeing, thinking, teaching. Visual Poetry.
https://quatrainfotographic.com
Offline
Just curious, do you add the include code to the ttg_head hook?
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
This is what I'm using. As you see, I tried with relative and absolute file paths.
<?php
/*
* TTG Core Elements "PHPlugins" User Hooks v1.2 - initialization mainline
...
*/
function user_load($style, $path) {...}
if (defined('BACKLIGHT_HOOK')) {...}
// v1
include("dlp_common.php");
// v2
include(realpath(BACKLIGHT_HOOK) . "/custom/phplugins/dlp_common.php");
class PHPlugins extends APHPlugins {...}
?>
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
Thanks Rod,
I haven't added the include code in the tag_head hook.
I didn't imagine it needing to work that way, but then it's times like this when I feel as though I'm in way over my head in this.
Quatrain ƒotographic, LLC
…seeing, thinking, teaching. Visual Poetry.
https://quatrainfotographic.com
Offline
Thanks, Daniel... I'll give that a try.
Quatrain ƒotographic, LLC
…seeing, thinking, teaching. Visual Poetry.
https://quatrainfotographic.com
Offline
Sorry to say that I'm not finding any success with this.
Although this method works fine outside of Backlight, without additional coding elsewhere...
<?php include("winter_dates.php"); ?>
...this doesn't work in Backlight.
...inside of Backlight, even with the addition of the code to the TTG Head Hook noted previously, it doesn't produce data from the target file.
I'm wondering if PHP settings on the server need to be tweaked?
Don
Quatrain ƒotographic, LLC
…seeing, thinking, teaching. Visual Poetry.
https://quatrainfotographic.com
Offline
Syntax.
function main_top() {
include 'someFile.php';
return false;
}
Offline
Hi Matt,
This works, thanks. I've used this include function in a footer with great satisfaction.
It appears that an include file can only be used within a designated, function _HOOK_() {...}
I was hoping to re-use a small table residing inside a grid column, from one page to the next with syntax nested after of the aforementioned HOOK. For instance...
<div class="col_3"><?php include("pho105_announce.php"); ?>
</div>
Even if this "announce.php file" resides inside the phplugins folder, it still doesn't work. I speculate that the Backlight eco-system is not conducive to seeing this the same, as it works with bootstrap.
I'm no expert at this stuff [and I apologize for my ignorance], yet I find it's interesting to touch some of the walls once inside Backlight. Keep up the great product development!
Thanks again for your insights.
Don
Quatrain ƒotographic, LLC
…seeing, thinking, teaching. Visual Poetry.
https://quatrainfotographic.com
Offline
Pages: 1