Author Topic: Trying to create simple droplet  (Read 2524 times)

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Trying to create simple droplet
« on: October 29, 2010, 04:25:18 PM »
I am trying to create a simple droplet, but being a non-coder this is even too difficult for me. Maybe someone can help me out. Must be very simple for coders  :roll:

I want this output:
Code: [Select]
<span class="wooo" price="true" text="In winkelwagen »">X</span>where X is the ID I want to set.

So for example I want to create:
Code: [Select]
<span class="wooo" price="true" text="In winkelwagen »">15</span>with a droplet like [[shop?id=15]]

After looking at other droplets I came up with this code, but it doesn't work:
Code: [Select]
$id = 'id=';
$retval .= '<span class="wooo" price="true" text="In winkelwagen »">';
$retval .= '$id';
$retval .= '</span>';
return $retval;

It works partially, because it returns:
Code: [Select]
<span class="wooo" price="true" text="In winkelwagen »">$id</span>
But I cannot figure out the id part... Please help me out! Thanks.
« Last Edit: October 29, 2010, 04:32:06 PM by Argos »
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Trying to create simple droplet
« Reply #1 on: October 29, 2010, 04:32:08 PM »
Hello Jurgen,
it seemsto me that you're almost done.

Change some lines only:
Code: [Select]
<?php //colorize the code, ignore this line

$id = (isset($id)) ? $id : &#39;you forgot the ?id parameter&#39;;
$retval .= &#39;<span class="wooo" price="true" text="In winkelwagen &raquo;">&#39;;
$retval .= $id//remove the &#39;&#39; <- quotes from the variable, otherwise it will be put out asplaintext
$retval .= &#39;</span>&#39;;
return $retval;

Regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Trying to create simple droplet
« Reply #2 on: October 29, 2010, 04:35:51 PM »
YES, that works beautifully! Very nice, thank you stefek, I really appreciate your quick help  :-D
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Trying to create simple droplet
« Reply #3 on: October 29, 2010, 04:40:02 PM »
You're welcome.

The one thing was, you overwrote the variable delivered via [[droplet-macro]]
And the other thing: the single quotes around the variable.

Regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline Argos

  • Posts: 2542
  • Gender: Male
    • Argos Media
Re: Trying to create simple droplet
« Reply #4 on: November 03, 2010, 01:19:03 AM »
Thanks for the explanation!

By the way: I needed this droplet to use with a smooth little webshop script: http://codecanyon.net/item/woooshop-shopping-cart-for-every-website/108838

Mind you, it's a very basic shopping cart script, and the admin is not integrated into WB. But it's smooth jQuery and easy to use for clients that don't need a full featured webshop. The droplet can be used for clients to simply add Buy Now buttons to items on regular WB WYSIWYG pages. They only need the item ID from the shop script admin, and put that in the droplet.
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
----------------------------------------------------------------
Please don't request personal support, use the forums!

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: Trying to create simple droplet
« Reply #5 on: November 03, 2010, 01:53:25 AM »
Looks good, Jurgen.

Good luck with your project.

If you need help on droplets again, just ask. ;-)

Regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

 

postern-length