kiwichick wrote:Hi Stefan,
I don't get the basename in the 'Replace this' field, I just get <curbase>.
That is shown in the above linked post too:
Code: Select all
<TEXTAREA WRAP=Off NAME="taINPUT" ROWS=14 COLS=90>'. "<get SelectedItemsPathNames>" .'</TEXTAREA>
How-to use XYplorer code inside HTML code
You have to understand that our whole HTML code is only an long string inside the html('...') command.
The trick here to include XY-vars is to escape from the HTML code for the moment,
concatenate an XYplorer $variable or XYplorer native variable like "<curname>",
and then continue with concatenate the remaining HTML code again.
For our code above we change
Code: Select all
Replace: <INPUT TYPE="TEXT" NAME="InputONE" SIZE="80" VALUE="string (to search)"><BR>
to
Code: Select all
Replace: <INPUT TYPE="TEXT" NAME="InputONE" SIZE="80" VALUE="'."<curbase>".'"><BR>
Let's take an closer look:
VALUE="string (to search)"
is replaced by
VALUE="'."<curbase>".'"
And the same with more spaces added to clarify:
VALUE="
' . "<curbase>" . ' "
Explanation:
' ---> will close and begin (means 'enclose') the HTML code string.
. ---> the dot is the XY script command to concatenate strings.
"<curbase>" ---> is an XY script native variable (see Help > Adv Top > Variables)
You can use e.g. <curbase>, <curname>, <curitem>, <curfolder>, <curpath>, <date>, "<get SelectedItemsNames>" or "<get SelectedItemsPathNames>"
Note:
the HTML code element VALUE itself needs surrounding double quotes: VALUE="my value"
which makes this example even more confusing, but i hope you get it.
This second example e.g. will make this more clear:
Code: Select all
<TEXTAREA >' . "<get SelectedItemsPathNames>" . '</TEXTAREA>
Additional tip:
If you want to include an $var inside the HTML string, do something like this:
$myVar = "<curbase>";
Code: Select all
Replace: <INPUT TYPE="TEXT" NAME="InputONE" SIZE="80" VALUE=" ' . $myVar . ' "><BR>
The next how-to is about having two buttons.
.