New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use $variables in find selector (latest dev version) #144

Closed
mjmurphy opened this Issue Jan 4, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@mjmurphy
Copy link

mjmurphy commented Jan 4, 2013

Cannot use a variable in a $pages->find selector. Using the latest dev version of PW. Despite using $sanitizer->selectorValue it still returns an error

Error: Exception: Unknown Selector operator: '=$' -- was your selector value properly escaped?

I have tried various combinations. Here is a simple test example that should work, but gives the error :

$test = 'basic-page';
$test = $sanitizer->selectorValue($test);
$selector_test = $pages->find('template=$test');
echo $selector_test->count();

Note : Using the $pages->get selector works ok when using $variables

@wanze

This comment has been minimized.

Copy link

wanze commented Jan 4, 2013

PHP does not parse variables in strings with single quotes.
Try:
$selector_test = $pages->find("template=$test");

@mjmurphy

This comment has been minimized.

Copy link

mjmurphy commented Jan 4, 2013

wow, thanks Stefan that was it! Was scratching my head all morning trying to work it out.

@mjmurphy mjmurphy closed this Jan 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment