Dec 04, 2008, 01:36 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Donate to MODx: Donations
Pages: [1]   Go Down
  Print  
Author Topic: Using the [+phx tag insite ditto template is not working  (Read 2466 times)
0 Members and 1 Guest are viewing this topic.
Dimmy
Testers
*
Posts: 1,827


Я не говорю по-русски 私は日本語を話さない


WWW
« on: May 15, 2007, 04:17 AM »

I use phx support for content manipulating like [+introtext:limit=`110`+], that works great but now I like to do this:

[+phx:mo=`Member`:then=`[+Member_price+]`:else=`[+price+]`+], but this return nothing. I think this is because the plugin that looks for the [+phx:tag+] will never see it. but is there another way that Ditto does use this tag and parse the phx part before the ditto part?

This would be a great addition to DItto.

I tried to make a tv with this line in it:
[+phx:mo=`Member`:then=`[*Member_price*]`:else=`[*price*]`+],
and called this new tv inside Ditto but this does not work eider.

Maybe I need to create a snippet instead?

Dimmy
« Last Edit: May 15, 2007, 05:24 AM by Dimmy » Logged

"They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, because if you play it forwards, it installs Windows."
Nederlands beste portal voor pda en mobiel internet
Dimmy
Testers
*
Posts: 1,827


Я не говорю по-русски 私は日本語を話さない


WWW
« Reply #1 on: May 15, 2007, 06:41 AM »

This did not work eider:

@EVAL if ($modx->getLoginUserID()) return '[*Member_price*]'; else return '[*price*]';


Does DItto not support this kind of TV usage?


Dimmy
Logged

"They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, because if you play it forwards, it installs Windows."
Nederlands beste portal voor pda en mobiel internet
heliotrope
Coding Team
*
Posts: 2,447


WWW
« Reply #2 on: May 15, 2007, 06:45 AM »

Hi,

I guess you could use a custom placeholder to achieve what you trying to do.
there are some sample code in the ditto extenders folder.

:-)
Logged

Dimmy
Testers
*
Posts: 1,827


Я не говорю по-русски 私は日本語を話さない


WWW
« Reply #3 on: May 15, 2007, 07:37 AM »

I looked at extenders but i do not grasp it. are there some detailed example including the steps what to do and the ditto call and template?


I realy like to learn this but I can't find any explenaition that I understand.

Greets Dimmy
Logged

"They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, because if you play it forwards, it installs Windows."
Nederlands beste portal voor pda en mobiel internet
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #4 on: May 15, 2007, 10:28 AM »

@Post 1:The items in your first post are returning nothing because Ditto can't (yet) see the nested placeholders. Assuming you are using Ditto 2, append &hiddenFields=`Member_price,price` to the call and continue using [+phx:mo=`Member`:then=`[+Member_price+]`:else=`[+price+]`+] in the template.

@Post 2: Where did you put that @EVAL line?

@Post 3: If you would like to learn, take a look at the example extender. Its fully commented and includes all of the features possible in an extender.
Logged

Dimmy
Testers
*
Posts: 1,827


Я не говорю по-русски 私は日本語を話さない


WWW
« Reply #5 on: May 15, 2007, 12:17 PM »

@Post 1:The items in your first post are returning nothing because Ditto can't (yet) see the nested placeholders. Assuming you are using Ditto 2, append &hiddenFields=`Member_price,price` to the call and continue using [+phx:mo=`Member`:then=`[+Member_price+]`:else=`[+price+]`+] in the template.
Nice this works like a cham. great

Quote
@Post 2: Where did you put that @EVAL line?

in a 3th tv that is then called instead of the phx

Quote

@Post 3: If you would like to learn, take a look at the example extender. Its fully commented and includes all of the features possible in an extender.

I see what you mean I was looking in the wiki and the ditto.modxcms.com docs but those examples where not there. I looked at the example and I think I start to grasp it

Thanks for the help
Logged

"They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, because if you play it forwards, it installs Windows."
Nederlands beste portal voor pda en mobiel internet
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #6 on: May 16, 2007, 10:32 PM »

Dimmy, I just committed a fix to the source code that should let you use nested placeholders without &hiddenFields. If you get a chance, please try it out and let me know how it works.
Logged

Dimmy
Testers
*
Posts: 1,827


Я не говорю по-русски 私は日本語を話さない


WWW
« Reply #7 on: May 17, 2007, 04:59 AM »

I downloaded latest trunk but now I get this error:
Code:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
 
PHP error debug
  Error: Compilation failed: nothing to repeat at offset 13
  Error type/ Nr.: Warning - 2
  File: /home/httpd/vhosts/1-vision.nl/subdomains/min/httpdocs/assets/snippets/ditto/classes/template.class.inc.php
  Line: 87
  Line 87 source: preg_match_all('~\[\+([^\+\]]*+)\+\]~' , $tpl, $matches);

I removed the phx tags from the template but still the same result

I tryed downloading the developers release from the link in your footer but the tar argive looks corupted.
in ubuntu I get this error:
Code:
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Error exit delayed from previous errors
and in winrar  (windows) i get this:
Code:
!   C:\Documents and Settings\Dimmy\Local Settings\Temp\ditto_rev_1432.tar.gz: The archive is corrupt
!   C:\Documents and Settings\Dimmy\Local Settings\Temp\ditto_rev_1432.tar.gz: Unexpected end of archive

ok on mac it worked but got the same error.
« Last Edit: May 17, 2007, 05:25 AM by Dimmy » Logged

"They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, because if you play it forwards, it installs Windows."
Nederlands beste portal voor pda en mobiel internet
Mark
Moderator
*
Posts: 3,247


Ditto Developer


WWW
« Reply #8 on: May 17, 2007, 08:01 PM »

Could you provide your entire template for debugging purposes? Thanks. As for the archive trouble, I'll look into it.
Logged

Dimmy
Testers
*
Posts: 1,827


Я не говорю по-русски 私は日本語を話さない


WWW
« Reply #9 on: May 18, 2007, 02:45 AM »

Code:
<table width="100%">
<tr>
<td class="kolom1" valign="top" align="left">
<form method="post">
<input type="hidden" name="token" value="[*timestamp*]" />
<input type="hidden" name="itemid" value="[+id+]" />
<input type="hidden" name="name" value="[+title+]" />
<input type="hidden" name="price" value="[+phx:mo=`MiNkapper`:then=`[+MiNkapper_prijs+]`:else=`[+Particulier_prijs+]`+]" />
<input type="hidden" name="points" value="[+tvshopShippingPoints+]" />
<span id="numberofitems" style="color: #000">Aantal: &nbsp;</span>
<input type="text" id="hoeveelheid[+id+]" name="quantity" value="1" />
<input type="button" id="plusone" value="+" onmousedown="plus_one_edit('hoeveelheid[+id+]');" />
<input type="button" id="minusone" value="-" onmousedown="minus_one_edit('hoeveelheid[+id+]');" /><br />
<input type="submit" name="add" value="Toevoegen" />
</form>
</td>
<td class="kolom2" valign="top" align="left"><div id="thumbscontainer">
<a href="[~[+id+]~]">[[MaxiGallery? &galleryOuterTpl=`MG_outertpl` &dipslay=`embedded` &embedtype=`none` &gal_query_ids=`[+id+]` &limit=`1` ]]</a></div></td>

<td class="kolom3" valign="top" align="left"><span class="producttitel"><a href="[~[+id+]~]">[+longtitle+]</a></span><br/><span class="tussenruimte"><br/></span><span class="productinfo"><a href="[~[+id+]~]">[+productinfo+]</a></span>
<td valign="top"><span class="productprijs"><a href="[~[+id+]~]">€ [+phx:mo=`MiNkapper`:then=`[+MiNkapper_prijs+]`:else=`[+Particulier_prijs+]`+] </a></span></td>
</td>
</tr>
</table>
<br />

I did try removing phx and MG tags but same error
Logged

"They say if you play a Microsoft CD backwards, you hear satanic messages. That's nothing, because if you play it forwards, it installs Windows."
Nederlands beste portal voor pda en mobiel internet
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!