How best to implement the idea

Hi!
I want to create landing page but with contact page
Strucutre

Home
 - Services [Collections]
 - - service 01
 - - service 02
 - - ...
 Contact page

In my Home page, I create slider witch load short content from the service page, when I click on the slide i create a js popup with fetch() the full content of the service page it was clicked

PROBLEM is
if I open service page with URL site.name/service01-URL it open the page but I don’t want to open it (it must open a popup on the main page with fetched content from service01). But URL Contact page must be opened normally

Questions

  1. How can i check URL of the site and if URL is child of Services page - load home page and open popup.
  2. Maybe you have batter idea how create this (maybe unpublished all services pages and create some page with type JSON and put all services there and then fetch URL with hash parameter via js site.name/#service01 to open popup?)
    Any idea?

Maybe not the best idea, but you could use an extra like Redirectoid in your service pages to redirect to the Home-page. And for example add a request parameter &urlParamString so you know what service to load on your Home-page.

Another way is the rewrite the request in the .htaccess file or in a plugin in MODX (probably on the system event OnMODXInit or OnHandleRequest).


Do the services need to be MODX resources?
Maybe you could instead store the information in a custom database table and then use something like CustomRequest.

1 Like

Thank you!
Good idea.
If i will used redirect does my js fetch will be working?
And if i create database how can content manager can add/edit content?

How do you fetch the data? As HTML using the resource-url?

Maybe you have to code a custom snippet, that detects if it is an AJAX-request ($_SERVER['HTTP_X_REQUESTED_WITH']) and only redirects if it’s not.


You’d have to create a custom manager page (CMP) to edit the data.
If you are familiar with MIGX then you could use MIGXdb for that.

yes fetch(pageUrl)

thank you, i will read about it

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.