Hi
I have a snippet that opens a modal window using Javascript’s window.open(...) method. The challenge I have is that it opens with the default template included.
How do I reset the <head> contents so that I have a window without the default template, but still within the scope of MODx.
Thanks,
Tino
-
MODX Staff
- 1,535 Posts
If your lightbox is a MODx page, just define a new template with your required <head> contents etc., and assign it to the page.
Garry Nutting
Senior Developer
MODX, LLC
Email:
[email protected]
Twitter: @garryn
Web: modx.com
Hi, thanks for responding.
The window that pops up is not really a new page. But the index.php page with some chunks I would like to place in it. The part about generating and displaying chunks would not be a problem. The challenge is getting it to start blank without a template.
An example is the way QuickEdit works. When you edit content on front page, the pop up is actually index.php with query strings for further processing(correct me if I’m wrong). That’s what it looks like outside the hood.
I guess I’ll have to look into the way QuickEdit was done but I would really appreciate a clear cut way I can do it, if its available in MODx. I thought there would be a method similar to $modx->regClientScript, but flushes the <head>
I have a feeling it will be expensive, resource-wise or computationally.
-
MODX Staff
- 1,535 Posts
I still don’t see why you can’t have a lightbox-specific document within MODx which utilizes a lightbox-specific template and run all lightbox requests through that. In effect, that is what you’re trying to hack into the template with the above solution - it’d be much more efficient to just go with a separate document.
As all MODx documents pass through index.php, you’d have access to the full MODx API, snippet and chunk processing etc.
Although, it depends largely on what your lightbox is trying to do - is this going to be a site-specific setup or are you trying to create something that can be installed on multiple sites?
Garry Nutting
Senior Developer
MODX, LLC
Email:
[email protected]
Twitter: @garryn
Web: modx.com
This is my scenario:
Front-end:
The snippet searches through certain data from the database.
On each search result, there is a link that opens a pop-up window...without intention of getting rid of the search results. The user clicks a link, the pop up window appears then he/she submits an enquiry on that particular search result. The user can close the pop-up window, scroll down the other results and submit enquiries as he/she desires.
Backend:
The link that pops up a window contains a query string that is then accessed by the snippet to process the submission. The snippet also places a chunk within that pop-up window.
I cannot say I am fully able to think in MODx, but I thought to get rid of the template, I would have to place conditions in it. I would like to hear your suggestion on the best approach...bearing in mind that the search results should be preserved