You are not logged in.
Hmmm, if this is in an article, have you set it to ignore Textile? Putting PHP tags in a textiled article sometimes gives freaky unexpected results like that, in my experience.
EDIT: also, the dangling single quote in the last line :-)
Last edited by Bloke (2008-08-15 17:47:39)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern.
Txp Builders – finely-crafted code, design and Txp
Offline
Well I did insert notextile. I also insert another before the added part but I still get an error.
OH. I need to add in another quote, the ending to the first quote?
Now working :)
Last edited by Ruhh (2008-08-15 18:46:11)
<txp:Ruhh />
Offline
Err! I don’t think I’m happy with the result.
I don’t know if it has to do with the version of TXP but I put in two else tags along with two smd_if tags. Is that possible?
Here is my code:
<txp:smd_if field="urlvar:a" operator="isused">
<txp:php>
include('http://domain.com/index.php?a=' .$_GET['a']. '');
</txp:php>
<txp:else />
<txp:smd_if field="urlvar:page" operator="isused">
<txp:an7_filter>
<txp:php>
include('http://domain.com/index.php?page=' .$_GET['page']. '&x=');
</txp:php>
</txp:an7_filter>
<txp:else />
<txp:an7_filter>
<txp:php>
include('http://domain.com/index.php');
</txp:php>
</txp:an7_filter>
</txp:smd_if>
</txp:smd_if>
the a page have no errors but the numbered page gets this error:
Notice: Undefined index: page on line 1
Last edited by Ruhh (2008-08-15 19:06:40)
<txp:Ruhh />
Offline
No, it isn’t possible to nest identical tags in 4.0.6. It will be possible in next version.
Offline
Ah.. okay. Is there a download of 4.0.7 available?
I got both parts to work by using chh_if_data tags.
Last edited by Ruhh (2008-08-15 19:13:26)
<txp:Ruhh />
Offline
I made some time ago an alternative article listing. User can select to list articles with or without article image thumbs. No I’m in need to offer second textlist, this time sorted and titled by data in custom field. I don’t currently have access to dev machine, but obviously this wont be work – because of one smd_if inside other?
smd_if urlvar textonly = yes
|
show textlist, form = article title-based listing
txp:else
|
smd_if urlvar textonly_v2 = yes
|
show textlist, form = custom1 as link, sortby = custom1
/smd_if
|
txp:else
|
normal list with images
/smd_if
Hmm… any ideas? Wouldn’t mind to build extra-page with article custom, if it is avoidable.
Offline
You might try if chs_if_urlvar still works with 4.0.7.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Just wonder, is it possible to add “core’s” conditions, like:
Because sometime I need to check if it’s if_article_list and <txp:variable /> has some value, or matchs some params. It would be nice adding :)
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
the_ghost wrote:
Just wonder, is it possible to add “core’s” conditions <snip>
txp:variable, I agree would be useful and is indeed very simple to add. Will be in the next official version.
The result of if_article_list / if_individual_article are much trickier because they aren’t parsed by the plugin. Even if they were, consider this fictional tag syntax:
<txp:smd_if field='<txp:if_article_list />' operator="istrue">
// In a list
</txp:smd_if>
From the plugin’s perspective, if you are viewing an article it sees this:
if (@nothing@ == true) {
// Gives a syntax error
}
because the output of <txp:if_article_list /> is empty / nada / nothing in an article context. Thus, parsing this is not easy.
For now, can you get away with a bit of nesting:
<txp:if_article_list>
<txp:if_variable name="my_var" value='<txp:php>echo gps('my_url_var');</txp:php>'>
// Yay! Article list AND variable matches URL variable
</txp:if_variable>
</txp:if_article_list>
Only very simple equality tests can be performed this way so if you desperately need the txp:variable functionality, make the following changes to the plugin code…
Change line 2 to read:
global $thisarticle, $pretext, $thisfile, $thislink, $variable;
Line 126 (immediately before } else if ($fldParts[0] == "urlvar") {) :
} else if ($fldParts[0] == "txpvar") {
if (count($fldParts) == 2) {
$fld = '$variable["'.$fldParts[1].'"]';
}
New line 163 (immediately before } else if (strpos($valParts[0], "?") === 0) {) :
} else if ($valParts[0] == "txpvar") {
if (count($valParts) == 2) {
$val = (isset($variable[$valParts[1]]) && $variable[$valParts[1]] != "") ? '$variable["'.$valParts[1].'"]' : doQuote(str_replace('"', '\"', $valParts[1]));
}
That should work but it’s not very thoroughly tested.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern.
Txp Builders – finely-crafted code, design and Txp
Offline
New major revision out in the guise of v0.7 [ compressed ]
Key features:
in and notin so you can check a list of things against a single fieldlist_delim (for use with in and notin)<txp:variable /> so you can now directly compare multiple txp vars without having to embed the tags. Use txpvar:my_var syntaxTake it for a spin round the block and toot the horn if you spot a CTA on the journey…
The smd plugin menagerie — for when you need one more gribble of power from Textpattern.
Txp Builders – finely-crafted code, design and Txp
Offline