I am building some normal contant pages, and under my the “normal HTM content” I would like to include pictures from a relevant predetermined search. Kind of like “Insert results” instead of “insert alblum”
You can see what I am trying to do below - not to display the link of the search, but the actual pictures of the search.
I can’t think of a good way to do this at the moment. Maybe later, if we ever integrate keyword search into the JSON API. Not sure when or if that will happen, though.
For now, the best way is probably to put the images you want into an album and embed it.
Yes pretty keen to see if I can get this working. My site heavily relies on search/metadata and to an extent that is what creates my “albums”.
I will see if there is some Javascript / JQuery code which may be able to do the trick and post here if I get a solution. My single image pages are not getting indexed at all (becasue they are all the same) so I need to generate pages with unique content with associated images.
Appreciate you help as always and am really enjoying BL3.
Please add your code as ‘preformatted text’. You can click the </> icon to get it. This way, your quotes are not translated into smart quotes and the code looks a bit nicer.
As @rod_barbee indicated, you use a string delimited by single quotes inside your echo statement that uses single quotes too. Either escaping or double quotes should be used. In my example above, I use double quotes.
I don’t think that file_get_contents works for the backlight search page. You might want to look at using curl. Have a look at my example for fetching JSON at https://lab.danielleu.com/blog/using-backlight-3-json-api-from-php-take-2/. By removing json_decode() should get you the HTML code of the search.
Please note that some hosts block curl requests originating and targeting their own server!
Additionally, you will need to strip a lot of data from $html since you don’t want to embed an entire page.
Dan I have looked at your code on your JSON explanation page and come up with the below. Not sure how the two functions are suppose to exist - or whether I merge this code into one function?
I guess you overlooked a little hint I wrote at the end of my post:
If you’d like to use this smart album in a regular page, you need to add an empty album in Backlight in order to have the proper css and javascript, and use the ‘main_top’ or ‘main_bottom’ phplugins function.
I created an album called ‘empty’ just for such purposes.
Navigate to “National Parks” - “Mount Field” on the menu and you should see a mix of text content and images
Then navigate to “Nature” - “Rainforest” and you again will see text content and images, including images that were also displayed in the “Mount Field” … “smart album”.
You can do the same for “Snug” (notice a couple of images of beaches) and “Beaches” (notice a couple of images from Snug)!
All images being displayed on these content pages are based on metadata and search queries! Hundreds of pages with smart albums can be created this way!