I've considered having an instring conditional for a long time--but have in
the past relegated it to one of several plugins in phptools.php. But I've
thought about it enough times to perhaps make it worth adding it to the
core for the next release.

But after looking at your code, it seemed so similar to the insource
conditional, I though perhaps we could enhance that instead by changing the
first and adding the second line:

function BOLTCinsource($args='') {
$data = BOLTinit(BOLTescape(BOLTFsource($args), false), $args['string']);
$find = BOLTinit($args[2], $args['find']);
if ($find == '') return false;
$find = str_replace('\n', "\n", $find);
if ($args['case'] == 'false') {
$data = strtolower($data);
$find = strtolower($find);
}
if (strpos($data, $find) !== false) return true;
return strpos($data, BOLTutf2url($find));
}

So if you do [if insource string={p} find=word] you should get the same
results. I think the last line should be utf2url, not url2utf ?

Cheers,
Dan



On Fri, Oct 10, 2014 at 4:28 AM, Tiffany Grenier <[email protected]>
wrote:

> Hi again,
>
> I don't know if I should add this as a plugin, but while playig with
> Boltwire, it came to me that the if conditions missed something just like a
> simple substring
> Hence, the following condition function:
> function BOLTCinstring($args='') {
> ## CHECKS TO SEE IF AN ITEM (FIND OR POS2) IS IN GIVEN SRING (VALUE OR
> POS1). USEFUL TO LOOK FOR SUBSTRING OF MANY VARS... VALUE DEFAULTS TO
> CURRENT PAGE TITLE AND FIND DEFAULTS TO CURRENT ID. CASE INSENSITIVE IF
> CASE IS SET TO FALSE.
>     global $pageLink, $BOLTid;
>     $content = BOLTinit($pageLink, $args[1], $args['value']);
>     $find = BOLTinit($BOLTid, $args[2], $args['find']);
>     if ($args['case'] == 'false') {
>         $content = strtolower($content);
>         $find = strtolower($find);
>         }
>     if (strpos($content, $find) !== false) return true;
>     $find2 = BOLTurl2utf($find);
>     if (strpos($content, $find2) !== false) return true;
>     }
>
> I am using that to display all pages whose url contain a given substring.
> I did not want to use data fields or info fields for that, and most of the
> time, the substring I am looking for is itself the substring a a page url
> part. Also, I am looking for quite generic terms that will for sure appear
> in the content of many other pages which I don't want to return as a result.
>
> As people may want to overuse this condition instead of using what already
> exists in very powerful ways for the search, list and other features using
> condtions, I am proposing to add that as a plugin, but you tell me.
>
> Cheers,
> Tiffany
>
> --
> You received this message because you are subscribed to the Google Groups
> "BoltWire" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/boltwire.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"BoltWire" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/boltwire.
For more options, visit https://groups.google.com/d/optout.

Reply via email to