Before asking for help please read "Requesting Help and Suggestions" by clicking on that tab above here.
  • Page:
  • 1
  • 2

TOPIC:

Embed "on this day" in an iframe on another website 2 months 2 weeks ago #21

Ok thanks for solution
I will try
I will give news after these tests
Regards
Gilbert

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 2 months 2 weeks ago #22

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 15173
I note that your site sets the header X-FRAME-OPTIONS=ALLOW on the "GET" request for the home page.

I note that this is NOT set on any POST request. This is why form-submissions aren't working.

I note that your posted code set the header to "Allow", not the "ALLOW" that I am seeing.

Please post again the exact code that you are running on your site.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 2 months 2 weeks ago #23

Hi,
in direcetory webtrees/modules_v4/middleware/
the file module.php
<?php

/**
* An example module to demonstrate middleware.
*/

declare(strict_types=1);

namespace MyCustomNamespace;

use Fisharebest\Webtrees\Module\AbstractModule;
use Fisharebest\Webtrees\Module\ModuleCustomInterface;
use Fisharebest\Webtrees\Module\ModuleCustomTrait;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

return new class extends AbstractModule implements ModuleCustomInterface, MiddlewareInterface {
use ModuleCustomTrait;

/**
* How should this module be identified in the control panel, etc.?
*
* @return string
*/
public function title(): string
{
return 'AAGestion iFrame';
}

/**
* Code here is executed before and after we process the request/response.
* We can block access by throwing an exception.
*
* @param ServerRequestInterface $request
* @param RequestHandlerInterface $handler
*
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
// Code here is executed before we process the request/response.



// Generate the response.
$response = $handler->handle($request);

// Code here is executed after we process the request/response.
// We can also modify the response.
$response = $response->withHeader('X-Frame-Options', 'ALLOW');

return $response;
}

};

I can see it in the modules configuration
I can see the website but I can't login

Regards
Gilbert

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 2 months 2 weeks ago #24

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 15173
There is a regular user on the forum who uses webtrees in an iframe on a joomla site.
So, it is certainly possible.
But I cannot find/remember the URL of his site.

Your module appears correct.
I see the expected header when I fetch (GET) a page.
But when I submit (POST) a page, the response has the original SAMEORIGIN header.

I do not know why this is happening.

Perhaps there is something else on your server that sets this?
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 2 months 2 weeks ago #25

I have found the website:
www.verwandten.info/
but the webtrees site is www.verwandten.info/wt2
it's not a sub-domain but a subdirectory
Bertkoor said that the way to do
Regards
Gilbert

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 2 months 2 weeks ago #26

Hi the method proposed by Bertkoor is fine
if webtrees is in a subdirectory it's ok and I can login
Regards
Gilbert

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 2 weeks 1 day ago #27

  • GMShimokura
  • GMShimokura's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 11
Hi
I am interested in this feature as well (I am running webtrees 2.0.16) but am not really a programmer and an amateur administrator.

I would like to embed the "On This Day" in another php page on the same server (which is private).

I have managed to get this custom module_v4 enabled I (I call it iframe-enable)

I am able to see a blank box on my php page, so I am not sure if it working.
My iframe embed code is
<iframe src='../webtrees'></iframe>

What is the proper way to specify the content such as "on this day" that should appear?

I am not sure if there is a log file ... to check? I have checked the apache log, seems fine.

Gregg

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 2 weeks 1 day ago #28

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 15173
> I would like to embed the "On This Day" in another php page on the same server (which is private).

Look at the HTML source code for the block. You should see a CSS ID with a block number. e.g.
<div id="block-123">

You'd fetch this block with a request to the URL /tree-page-block?block_id=123
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 2 weeks 1 day ago #29

  • GMShimokura
  • GMShimokura's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 11
Thanks for the very quick reply.

Yes that works great.

The data from On this Day now appears but has lost all the nice styling.

Any suggestion on how to recreate the styling?

Gregg

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 2 weeks 1 day ago #30

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 15173
Do you want the exact same styling as used in webtrees - or something that matches the page that hosts the iframe?

You could copy the CSS from webtrees. e.g. the styling for the webtrees theme is here.
For other themes, find the equivalent file.
github.com/fisharebest/webtrees/blob/mai...btrees.css#L446-L490
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 2 weeks 1 day ago #31

  • GMShimokura
  • GMShimokura's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 11
Hi. I was thinking the same as Webtrees to show the same look in the destination frame.

So the pointer to the Webtrees CSS is useful.

Thank you

Gregg

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 2 weeks 8 hours ago #32

  • GMShimokura
  • GMShimokura's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 11
Hi Again,
Just to ask if there are any examples out there for apply CSS from the parent page to the iFrame..
It seems it is not trivial because:
- Linking CSS seems only to work if done in the header of the destination frame page
- When you reference a block_id as in this case there is no header portion of the destination frame page (and I think this is why the formatting is lost).
Gregg

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 1 week 5 days ago #33

  • fisharebest
  • fisharebest's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 15173

Hi Again,
Just to ask if there are any examples out there for apply CSS from the parent page to the iFrame..
It seems it is not trivial because:
- Linking CSS seems only to work if done in the header of the destination frame page
- When you reference a block_id as in this case there is no header portion of the destination frame page (and I think this is why the formatting is lost).
Gregg

I think you are probably correct. I haven't used iframes for a while, and had forgotten how they work.

Instead, perhaps, add the CSS to the other page, and use JS to load the block into an empty div element instead of an iframe.
Greg Roach - This email address is being protected from spambots. You need JavaScript enabled to view it. - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 1 week 5 days ago #34

  • GMShimokura
  • GMShimokura's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 11
Hi, Thanks for the hint.

Do you have an example to share or point me to or search phrase to use?

I can't seem to find a relevant example where a block of a page is embedded in another page with proper formatting.

Also if I use a div and javascript do I still need the custom middleware module?

Optimistically,

Gregg

Please Log in or Create an account to join the conversation.

Embed "on this day" in an iframe on another website 1 week 1 day ago #35

  • GMShimokura
  • GMShimokura's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 11
Hi again,

Alternatively is there an API or way to query my webtree to get the "On This Day" information that could be included and reformatted on a different site?

Gregg

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Powered by Kunena Forum