Advertisement:

Author Topic: AJAX-related inquiry  (Read 233 times)

Offline Study Force

  • SMF Hero
  • ******
  • Posts: 3,285
    • StudyForcePS on Facebook
    • @studyforceps on Twitter
    • Study Force
AJAX-related inquiry
« on: August 09, 2018, 10:47:40 AM »
Is it possible to dynamically load a function within a template file without loading the header and footer?

Assuming that the URL loads:

website.com/index.php?action=xyz

I've managed to work it by using exit(); at the very end, but in case there's a better method, I'd like to know.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 69,071
    • StoryBB/StoryBB on GitHub
Re: AJAX-related inquiry
« Reply #1 on: August 09, 2018, 11:26:24 AM »
Set $context['template_layers'] to an empty array to skip them.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

Nothing turns to hate so bitter as what once was love.

Offline Study Force

  • SMF Hero
  • ******
  • Posts: 3,285
    • StudyForcePS on Facebook
    • @studyforceps on Twitter
    • Study Force
Re: AJAX-related inquiry
« Reply #2 on: August 09, 2018, 08:14:16 PM »
On a similar note, how do I stop Google from crawling these AJAX-based pages?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 69,071
    • StoryBB/StoryBB on GitHub
Re: AJAX-related inquiry
« Reply #3 on: August 10, 2018, 02:59:00 AM »
Don’t link to them in the first place?

Failing that there is a directive you can set in $context to emit a no index, but I don’t remember what it is offhand.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

Nothing turns to hate so bitter as what once was love.

Offline Study Force

  • SMF Hero
  • ******
  • Posts: 3,285
    • StudyForcePS on Facebook
    • @studyforceps on Twitter
    • Study Force
Re: AJAX-related inquiry
« Reply #4 on: August 10, 2018, 10:42:53 AM »
Don’t link to them in the first place?

Failing that there is a directive you can set in $context to emit a no index, but I don’t remember what it is offhand.

It's hard not to, and even if I don't via some javascript code, search engines still get to them