Here's a few quick responses to your suggestions...
On Mon, Sep 28, 2015 at 3:27 AM Tiffany Grenier <[email protected]>
wrote:
> Hi,
>
> Here are a couple of additional suggestions and change requests that I
> would love to see in the next version of Boltwire, as well as the reasons
> for such changes:
>
> - add an "ouput=false" parameter to the counter function, so the user
> can increment a counter inside a template, while displaying the result, and
> show an alternative text for each 5th item fulfilling a given condition (I
> also think of using it to create columns based on the value of a data var)
> The last line of BOLTFcounter would become:
> if($args['output'] != 'false') return $BOLTfuncMem['count'][$id];
>
> There already is an output=false parameter available for all functions
(it's built into the core system). It suppresses all output for the given
function so there is no display. There's also an output=source, html,
nolines, & escape.
Not sure I understand exactly what you are trying to do with your template
but I think what you want is to be able to check the count in a conditional
without incrementing the count. You can do this by using [(counter id 0)].
Basically it adds 0 to the current count.
You would then put [(counter id output=false)] where you want to count
iterations but not display anything.
Here's an idea I haven't tested, but which you might want to try:
[if equal 5 [(counter id 0)] ]Fifth item<(counter id start=0
output=false)>[if]
each {+p}... [(counter id output=false)]
It may not be what you need, but this should reset the counter to 0 each
time it hits 5 making the conditional check easy. Not tested, but you could
try tinkering with this...
>
> - enhance the BOLTinclude function by allowing to pass a page to the
> baselinks parameter, so the user can display the header of a given page by
> doing [(include some.page zone=header baselinks=some.page)]
> The conditional around the baselinks would become:
> if ($args['baselinks'] != '') {
> if ($args['baselinks'] == 'true') {
> $args['baselinks'] = $page;
> }
> $temp = $pageLink;
> $pageLink = $args['baselinks'];
> $out = BOLTescape(BOLTdomarkup($out, $args['baselinks'], '',
> $args['rules']), true, true);
> $pageLink = $temp;
> }
> else {
> $out = BOLTescape(BOLTdomarkup($out, ''), true, true);
> }
>
> This is a great idea! Works beautifully.
>
> - add the optgroup tag as a complement to the option tag. This would
> be great for organising the selection possibilities.
> The markup line would become:
> MarkUp('form', 'inputs',
>
> '/(\n?)\[(form|command|text|check|radio|password|hidden|select|option|optgroup|box|file|button|submit|reset|image|color)((
> {1,2}([-_a-z0-9]+=)?([-_a-z0-9]+\[\]|\"[^\"]*\"|\'[^\']*\'|[^\] ]+))*)?
> ?\]/ie', "BOLTMinputs('$2', '$3', '$1')"); // form and all inputs
> The allowed HTML declaration would contain in variables.php:
> $BOLTattrs['optgroup'] = 'id,label,class,style,disabled';
> And the BOLTMinputs function would have the following content:
> [...]
> $attr = trim(BOLTstripSlashes($attr));
> if ($attr == '') {
> if ($type == 'select') return '</select>';
> if ($type == 'optgroup') return '</optgroup>';//NEW LINE
> if ($type == 'box') return '</textarea>';
> }
> if ($type == 'form') return BOLTMforms($attr, $initial); // setup
> form
> $args = BOLTargs($attr);
> if ($type == 'option') {
> if ($args['value'] == '') $args['value'] = $args[1];
> }
> else {
> if ($type == 'optgroup') {//NEW LINE
> if ($args['label'] == '') {//NEW LINE
> $args['label'] = $args[1];//NEW LINE
> unset($args[1]);//NEW LINE
> }//NEW LINE
> }//NEW LINE
> $name = $args[1];
> unset($args[1]);
> $attr = substr($attr, strlen($name) + 1);
> if ($name == '') $name = $type;
> if ($name == 'jump') $args['js'] = 'jump';
> }
> if ($type == 'command') { // store commands as session values
> [...]
> case 'option' :
> if (isset($label)) return BOLTescape("<option
> $attr>$label</option>");
> else return BOLTescape("<option $attr />");
> case 'optgroup' ://NEW LINE
> return $initial . BOLTescape("<optgroup $attr>");//NEW LINE
> [...]
>
> This is very cool. Wasn't familiar with this html tag. :) Will be in next
release.
>
> - Fix the calling of the gui attribute of textareas, which is totally
> useless at the moment.
> The following lines would go into BOLTMinputs:
> if (isset($args['gui'])) {
> if (BOLTexists("code.embed.gui.$args[gui]")) $guipage =
> "gui.$args[gui]";
> else if (BOLTexists("code.embed.gui.$page")) $guipage =
> "gui.$page";
> else $guipage = "gui";
>
> I wouldn't call it totally useless. :) It works perfect if you set
gui=true. But agreed the $page variable is a bug if you want to use a
non-standard gui page. But shouldn't the fix just be this:
if (isset($args['gui'])) {
if (BOLTexists("code.embed.gui.$args[gui]")) $guipage = "gui.$args[gui]";
else $guipage = "gui";
I'll make this change. Let me know if I'm missing something. Sometimes I
don't always get my code...
> - Allow to have two wysiwyg textareas in the same page by explicitely
> settigs their IDs, because the script would now work in such a way that
> only the first textaera is updated from the two wysiwyg areas:
> First change in BOLTMinputs:
> if (BOLTexists("code.embed.$guipage")) {
> if (isset($cleanURL)) $gui =
> BOLTFembed(array('1'=>$guipage,
> 'cleanurl'=>$cleanURL,'areaid'=>$args['id'])) .
> BOLTFembed(array('1'=>'guiscript'));
> else $gui =
> BOLTFembed(array('1'=>$guipage,'areaid'=>$args['id'])) .
> BOLTFembed(array('1'=>'guiscript'));
> $args['id'] = 'BOLTgui'.$args['id'];
> }
> Second change in code.embed.guiscript (although this is no longer part
> of the standard installation):
> function insMarkup(mopen, mclose, mtext, areaid) {
> var id = arguments.length > 3 ? arguments[3] : '';
> var tarea = document.getElementById('BOLTgui'+id);
> Third change in code.embed.gui and other similar pages (same note as
> previously):
> Changles lines into something like: <a
> href="javascript:insMarkup('//','//','Italics','{+areaid}')">
>
>
I never noticed this about the gui script, probably because I have never
had two gui boxes on the same page together. But it is worth fixing, just
the same. My implementation was slightly different however. First, I didn't
want to have to require a separate id parameter for the gui so decided to
use the textarea name instead. I also decided to call it guiid rather than
areaid. I also rewrote the changes to code.embed.guiscript slightly to make
them easier for me to read. Also I discovered the cleanURL check seems to
be unnecessary, so I deleted it. Here's my final code:
BOLTMinputs:
if ($type == 'box') {
if (isset($args['gui'])) {
if (BOLTexists("code.embed.gui.$args[gui]")) $guipage = "gui.$args[gui]";
else $guipage = "gui";
if (BOLTexists("code.embed.$guipage")) {
$gui = BOLTFembed(array('1'=>$guipage, 'guiid'=>$args['name'])) .
BOLTFembed(array('1'=>'guiscript'));
$args['id'] = 'BOLTgui'.$args['name'];
}
}
}
code.embed.guiscript
function insMarkup(mopen, mclose, mtext, guiid) {
if (arguments.length > 3) var tarea =
document.getElementById('BOLTgui'+guiid);
else var tarea = document.getElementById('BOLTgui');
And of course code.embed.gui uses {+guiid}. It all seems to work. Let me
know if you notice anything. I left the cleanurl code in (commented) just
in case.
Two observations.
1) First, this will break sites using the old gui scripts. Easy enough to
fix them of course.
2) And second, if you happen to have two forms on a page with a textarea
each with the same name, this won't fix it. We could make the code smarter
to allow for an optional id, but let's see if there is a need for this. It
seems easy enough to rename one of the textareas.
> - Find a way to put the wysiwyg thing and the following textarea
> inside the same div (mainly for CSS reasons). Maybe create a guibox for
> that and remove completely the support of $args['gui'] in the "box" form
> item. No patch to propose for this, though.
>
> A good idea to have a separate [gui...][box...][box][gui], but I think
both the markup and the code would be more trouble than it is worth. Is
there some reason you can't do this if you need special styling?
<div id=mytextarea>[box name gui=true][box]</div>
>
> - Use the "mark" HTML tag for highlighted text instead of simply
> putting a background-color or a "highlight" class. This would allow to
> better handle the padding in the CSS and to produce some semantic value to
> the fact that something has been highlighted.
>
> How about just add mark to the allowed html elements? (last line of
variables.php). Then we can keep both. I think the highlight command is it
allows you to set multiple colors easily (without having to touch the css,
but I see the advantage of more control also. Seems like a good compromise.
> Besides that, I am working in an easy way to define new markup like
> similar to the italics, bold etc... (I would use them for font changes to
> predefined parameters, like ;;something;; would put the text in some
> cursive font) with as few lines of code as possible for each
> addition/change while reusing the BOLTMfontstyles and the BOLTMspanordiv
> functions.
>
Yes, I've thought about trying to use a more generic format for the code to
make it more expandable but haven't spent too much time on it. If you have
a suggestion let me know. One suggestion might be to reserve one or two
symbols for a default user defined style. For example, to the fontstyles
function could add:
case ';' : return $myDefinedStyleStart . $text . $myDefinedStyleEnd;
then you could put your tag in config.php. Just a suggestion. I haven't
made this change, but it seems easy enough... Could do the same with the
spandiv function:
if ($type == 'custom') return "<$html
style='$myDefinedSpanDivStyle'>$text</$html>";
Again, just thinking out loud. Obviously the two markup rules would have to
be updated, and this only gives us one custom style for each...
> I had also written down "allow to get search results in anon-unique way
> based on the unique parameter", but I can't seem to recall why/where I
> would use that so I guess it's not so important.
>
Got me on that one too! :)
Thanks for all the great suggestions. I hope to release BoltWire 5.05 later
this week.
Cheers,
Dan
--
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.