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.

#26 Re: Backlight 3 Customization » Getting Started with new JSON API » 2020-05-11 18:53:46

Ok Daniel and thank you very much,

I tried to remove all the other functions from the PHP files and leave only this one but I have to resolve to the fact that it does not work on my installation

My php:

<?php
/*
 *  TTG Core Elements "PHPlugins" User Hooks v1.2 - initialization mainline
 *
 *  developed by john bishop images (http://johnbishopimages.com)
 *  for Matthew Campagna of The Turning Gate (http://theturninggate.net)
 *
 */

function user_load($style, $path) {
  $g_tsvrl = explode(' ', $style); // Extract gallery type
  define ('G_STYLE', strtoupper($g_tsvrl[1])); // and set global for later
  $g_path = str_ireplace('\\','/',$path); // change \ to /
  $chunks = explode('/',$g_path); // and put into array
  define ('G_PATH', strtoupper($chunks[count($chunks)-2])); // gallery folder name is second to last
  //define ( 'TTG_SITE', ''); // set new site root for navigation, resources, etc.
}

if (defined('BACKLIGHT_HOOK')) {
	require_once(realpath(BACKLIGHT_HOOK).'/modules/module-designer/application/helpers/APHPlugins.php');
}

class PHPlugins extends APHPlugins
{
// Returns the JSON API response as an array
function dlp_get_wp_rest_response($url){
    $curl = curl_init();
     curl_setopt_array($curl, array(
       CURLOPT_RETURNTRANSFER => 1,
       CURLOPT_URL => $url,
       CURLOPT_USERAGENT => 'User Agent X'
     ));
     $posts = curl_exec($curl);
     curl_close($curl);
     return json_decode($posts, true);	
}
function footer_bottom() {
   $posts = $this->dlp_get_wp_rest_response("https://www.phototheque.nicolaslogerot.com/backlight/api/get_album/343971");
   echo "Array length: " . count($posts['album']['photos']);
}
}  
?>

and I have this message:

Something went wrong
count(): Parameter must be an array or an object that implements Countable in perso-home.php on line 39

I cannot relaunch an album from Lightroom at this time due to work on my home network, but I will try as soon as possible


Thanks for all for your help
Nico

#27 Re: Backlight 3 Customization » Getting Started with new JSON API » 2020-05-10 23:43:24

Oh yes thank you Rod,

Now the error is:

Something went wrong
count(): Parameter must be an array or an object that implements Countable in perso-home.php on line 147

#28 Re: Backlight 3 Customization » Getting Started with new JSON API » 2020-05-10 23:12:42

No problem  Daniel, thank you for all.

This:

function dlp_get_wp_rest_response($url){
    $curl = curl_init();
     curl_setopt_array($curl, array(
       CURLOPT_RETURNTRANSFER => 1,
       CURLOPT_URL => $url,
       CURLOPT_USERAGENT => 'User Agent X'
     ));
     $posts = curl_exec($curl);
     curl_close($curl);
     return json_decode($posts, true);	
}

	function footer_top {
   $posts = $this->dlp_get_wp_rest_response("https://www.phototheque.nicolaslogerot.com/backlight/api/get_album/343971");
   echo "Array length: " . count($posts['album']['photos']);
}

Send me:

Something went wrong
Unexpected error: syntax error, unexpected '{', expecting '(' in perso-home.php on line 145


Line 145 is: function footer_top {

#29 Re: Backlight 3 Customization » Getting Started with new JSON API » 2020-05-09 17:55:51

thank you very much Daniel, in fact this is a code that I have been using since version 2 of Backlight but it does not display the number of images of an album on a page without an album.  I would have liked to be able to display the number of images in the footer of each page, including the pages with only text, but I have to make a reason, my limited knowledge in php does not allow me to achieve this.

#30 Re: Backlight 3 Customization » Search Page Hero Image » 2020-05-09 08:37:47

Hi DavidOllila,

I put a "hero image" in my search page from Backlight 2.

Here is the html code that I use at the top of my search bar, you must enter this code in:
Backlight-> Languages-> US English-> Manage Language: Publisher and Search Intro (md)

You can see the result on this page:

https://phototheque.nicolaslogerot.com/ … /?q=Italie

HTML code:

<div class="hero-image">
  <div class="hero-text">
    <h1 style="font-size:45px"><span class="fas fa-binoculars">&nbsp;</span>Images search</h1>
  </div>
</div>

Then the CSS (which you can modify according to the appearance of your website):

/*Display text on image in search module

================================================================*/

.hero-image {
  background-image: url("https://yourwebsite.com//backlight/designer/page/image/17");
  width: 110%;
  margin-left: -10px;
  margin-top: -20px;
  height: 250px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  position: relative;
}

.hero-text {
  text-align: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  letter-spacing: 0.25rem;
  font-weight: 700;
  text-transform: uppercase;
  text-rendering: optimizeLegibility;
}

Nico

#31 Re: Backlight 3 Customization » Getting Started with new JSON API » 2020-05-09 08:21:23

Thank you very much Daniel
It seems it don't work

#32 Re: Backlight 3 Customization » Getting Started with new JSON API » 2020-05-07 16:03:04

Whao!  whao! Daniel your great! thanks you very much for that but my limited knowledge means that I don't know how to call this function in the place I want... hmm

Should I put this:

$posts = $this->dlp_get_wp_rest_response("https://yoursite.domain/backlight/api/get_album/12345");
echo "Array length: " . count($posts['album']['photos']);

in a function such as:

 function  footer_top() {

Thanks Nico

#34 Re: Backlight 3 Customization » Getting Started with new JSON API » 2020-05-07 03:10:35

This can be OK for displayed photos count of album id 343971 on any page page? But don’t work...

function scripts() {  
	
if ($this->hasAlbum()) {
	$albumId = $this->album->getId();
		 echo '
		  <script src="/backlight/modules/module-publisher/lib/js/jquery.api.js"></script>
      <script>
        var backlight = new Backlight()
        
        backlight.getAlbum("343971", {
          done: function  footer_top() {
          	if ($this->hasAlbum()) {
		 echo '<span data-lang="fr"><p class="imagenum"><strong>'.$this->album->getNumberOfPhotos().' images dans la photothèque</strong></p></span><span data-lang="en"><p class="imagenum"><strong>'.$this->album->getNumberOfPhotos().' images in the stock photo collection</strong></p></span>';
}
	return true;
},
          })
      </script>
   ';
  }
  return false;
}

#35 Re: Backlight 3 Customization » Getting Started with new JSON API » 2020-05-07 02:08:19

Hum interesting hmm but if you put album reference number like documentation it send an error:

Example:

backlight.getAlbum('. $albumId .', {

By:

backlight.getAlbum('12345', {

#36 Re: Backlight 2 Support » Cart question » 2020-05-05 23:50:12

I have find Ajax_item_options.php in module-cart>application>js who contain this code:

$purchaseOption = '<fieldset>' . $LINE_END;
	$purchaseOption .= '<input type="hidden" name="on' . $count . '" value="' . $attribute['title'] . '">' . $LINE_END;
	$purchaseOption .= '<label for="os' . $count . '">' .  $attribute['title'] . ': </label>' . $LINE_END;
	
	if (count($attribute['options']) == 1) {
		foreach ($attribute['options'] as $option) {
			$purchaseOption .= '<span class="text_option">'.$option['title'];
			$purchaseOption .= '</span>';
			$purchaseOption .= '<input type="hidden" name="os' . $count . '" id="os' . $count . '" value="'.str_replace('"', '&quot;', $option['title']).'">' . $LINE_END;
		}
	} else {
		
		$purchaseOption .= '<select name="os' . $count . '" id="os' . $count . '">' . $LINE_END;

		foreach ($attribute['options'] as $option) {
			$purchaseOption .= '<option value="' . str_replace('"', '&quot;', $option['title']) . '"';

			if ($item != null && isset($item->options[$attribute['title']]) && $item->options[$attribute['title']] == $option['title']) {
				$purchaseOption .= ' selected';
			}

			$purchaseOption .= '>' . $option['title'];
			$purchaseOption . '</option>' . $LINE_END;
		}

		$purchaseOption .= '</select>' . $LINE_END;
	}
	
	$purchaseOption .= '</fieldset>' . $LINE_END;

	return $purchaseOption;
}

Because of this with the web inspector:

Capture-d-cran-2020-05-05-16-34-22.png

But nothing happens

Nico

#37 Re: Backlight 2 Support » Cart question » 2020-05-05 20:53:52

No just the value « 6 mois » without percentage

#40 Backlight 2 Support » Php function » 2020-05-04 23:25:02

Nico3939
Replies: 2

Hello,

I would like to count the number of images on a specific page on a separate page that does not contain an album.

I know the php code which allows me to count the number of images presented in this album but can't seem to call the function on a separate page:

function  footer_top()
{
	//echo 'style: '.$this->style.'<br/>';
	//echo 'path: '.$this->path.'<br/>';
if ($this->hasAlbum()) 
{
		 echo '<span data-lang="fr"><p class="imagenum"><strong>'.$this->album->getNumberOfPhotos().' images dans la photothèque</strong></p></span><span data-lang="en"><p class="imagenum"><strong>'.$this->album->getNumberOfPhotos().' images in the stock photo collection</strong></p></span>';
}
	return true;
}

Does anyone have a solution?

thank you in advance
Nico

#41 Backlight 2 Support » Cart question » 2020-05-02 19:05:14

Nico3939
Replies: 4

Hi everyone,

For the Cart module, when you put a percentage value in the attributes, is it possible on the Front-end to display only the price in the drop-down list and hide the percentage after the price:

Capture-d-cran-2020-05-02-11-59-36.jpg

Thanks in advance
Nico

#42 Re: Backlight 2 Customization » Auto calculated image dimensions » 2020-04-29 04:34:56

Thanks Rod, but it seems we can make a line break in LUA by using  "\n" or "\r"

But it don’t work or I forget something

#43 Re: Backlight 2 Customization » Auto calculated image dimensions » 2020-04-29 02:32:45

Amazing Daniel thank you very much it works great!

One last question, is it possible to do a Carriage return?

#44 Re: Backlight 2 Customization » Auto calculated image dimensions » 2020-04-28 21:33:43

So for recap:

Dimensions: 5658 x 6880 px | 47,9 x 58,3 cm | 18,9 x 22,9 inches | 300dpi

--> 5658/300 = 18,86 inches

--> 18,86 x 2,54 = 47,9 cm


should it work?

Native dimensions: {CroppedWidth} x {CroppedHeight}px | ({CroppedWidth}/300)*2.54 x ({CroppedHeight}/300)*2.54 cm | {CroppedWidth}/300 x {CroppedHeight}/300 inches | 300dpi

#45 Backlight 2 Customization » Auto calculated image dimensions » 2020-04-28 19:27:52

Nico3939
Replies: 12

Hello,
Currently on the photo legend in the viewer, I display the pixel dimensions of the photos like this:
"Dimensions: 5658 x 6880 px"


On the other hand is there a means/a method allowing to make an automatic calculation to display the resulting size at 300dpi in this way?:

"Dimensions: 5658 x 6880 px | 47,9 x 58,3 cm | 18,9 x 22,9 inches | 300dpi"


thank you in advance
Nico

#46 Re: Backlight 2 Support » Cart auto switch language don't work » 2020-04-28 17:10:48

Hi Ben,
Firstly, thank you very much for the fix, it seems that now everything is working perfectly!

And for the diagnosis, I looked everywhere where the error came from, thinking that it was due to my installation and came across this file. I am on Backlight since version 1, never used CE2.

Again thank you for your responsiveness and the update, it's perfect, a great team always listening!

Nico

#47 Re: Backlight 2 Support » Cart auto switch language don't work » 2020-04-28 04:58:20

thank you Rod, that reassures me that the error would not only come from my installation.

what happens when you are logged in to the admin and enter this address?:

https://www.yourwebsite.com/backlight/c … iagnostics

« /cart/admin/diagnostics »

with me it returns an error:
Something went wrong
Invalid argument supplied for foreach() in diagnostics.php on line 215

(maybe it has nothing to do!)

Thanks
Nico

#48 Re: Backlight 2 Support » Cart auto switch language don't work » 2020-04-28 02:49:16

Hummm interesting, have to try that. I have test with Chrome and Safari but not with Firefox...

Thanks Rod, I’ll try that and post result

#49 Re: Backlight 2 Support » Cart auto switch language don't work » 2020-04-28 00:47:09

Thanks Rod,

That's it:
French --> 1
English --> 2

I also saw this in phpadmin> Admin-Master> Language and there is a language ID column

Unfortunately, whatever I put, Cart definitely doesn't want to translate!

I tried removing languages and republishing new ones, I also tried to deactivate PHPlugins in the advanced settings of the templates .... while emptying the browser cache and using the Backlight admin ... and much more but nothing helps

Nico

#50 Re: Backlight 2 Support » Cart auto switch language don't work » 2020-04-27 23:55:06

Hi,

In Admin > Setting > Show advanced Settings > Miscellaneous > Cart Language

what to put? "en" or "fr", the reference language in database 1 or 2...

However I register here nothing changes

Thanks
Nico

Board footer

Powered by FluxBB