-
☆ A M B ☆
- 24,524 Posts
For one thing, I would suspect that the second alias should be "index", not "index.html". MODx appends .html to the alias, so the alias itself is without the .html part.
to see the alias of a page:
-
☆ A M B ☆
- 24,524 Posts
That code doesn't make a lot of sense; where is the variable $alias defined?
Try
$alias = $modx->resource->get('alias');
if ($alias == 'contact' || $alias == 'index'){
return $modx->getChunk('demo');
}
return;
Snippets should never "print" or "echo", they should always "return" whether they return any output or not.
-
☆ A M B ☆
- 24,524 Posts
You could also do this with an output modifier:
[[*alias:is=`contact`:then=`[[$demo]]`]]
-
☆ A M B ☆
- 1,780 Posts
^^^^^ try that. So much simpler. :~}
-
☆ A M B ☆
- 24,524 Posts
Well, its simplicity comes at a price, it only works for one alias. If you want to check for multiple aliases, then you need the snippet.
-
☆ A M B ☆
- 1,780 Posts
Well, I imagine it's cuz I don't know php well that I misunderstand... But the || followed with the same alias, so it seemed like only one condition is applying anyway. heh... I'm sure I'm missing something important.