Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » How do I…?
  3. » doWrap

#1 2008-05-25 16:29:45

Ruhh
Member
From: dakota dunes
Registered: 2008-01-20
Posts: 305

doWrap

I was trying to add a break tag using the value, br but it does not work. I do not see a break at the end of the result. Is there something wrong with this?

return doWrap($out, $wraptag, $break, $class);

<txp:Ruhh />

Offline

#2 2008-05-25 19:16:51

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: doWrap

Please provide an example of the exact input and resulting return value.

Offline

#3 2008-05-25 22:26:50

Ruhh
Member
From: dakota dunes
Registered: 2008-01-20
Posts: 305

Re: doWrap

Well, this is one of the atts from the array:

'break' => 'br',

Then the contents of return:

return doWrap($out, $wraptag, $break, $class);

So the HTML output is:

Result1 Result2

My goal is to get:

Result1
Result2

So I guess the break in doWrap does not seem to work.


<txp:Ruhh />

Offline

#4 2008-05-26 00:05:25

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: doWrap

Are you representing $out or $list as an array? doWrap would expect that.

Offline

#5 2008-05-26 03:34:37

Ruhh
Member
From: dakota dunes
Registered: 2008-01-20
Posts: 305

Re: doWrap

yes $out as an array like so:

$out = array($something);

But the break doesn’t seem to work at all for me. The HTML output isn’t like so:

Result1<br />


<txp:Ruhh />

Offline

#6 2008-05-26 04:31:05

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: doWrap

doWrap has been around a while and I’m sure it works as advertised, an example of how you are using it would give some insight.

Offline

#7 2008-05-26 05:08:52

Ruhh
Member
From: dakota dunes
Registered: 2008-01-20
Posts: 305

Re: doWrap

the only way to get result2 on next line is by using li as the value for break but i wouldn’t want that.

i just use the tag created by the function like so <txp:abc_myplugin /> in a form. then i put another tag created by another function but same doWrap. the results from both tags are on the same line.


<txp:Ruhh />

Offline

#8 2008-05-26 07:56:29

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: doWrap

As I said before, please provide an exact code example and the return value.

Offline

#9 2008-05-26 22:12:30

Ruhh
Member
From: dakota dunes
Registered: 2008-01-20
Posts: 305

Re: doWrap

Oh ok.

function soc_numarticle($atts) 
{
     extract(lAtts(array(
         'label' => 'Articles',
         'labeltag' => '',
         'break' => 'br',
         'class' => '',
         'sep' => ': ',
         'status' => 'live',
     ), $atts));
     $status = getStatusNum($status);
     $sum = safe_count("textpattern", "status = $status"); 
     $out = array($sum); 
     return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
}

<txp:Ruhh />

Offline

#10 2008-05-26 22:57:51

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: doWrap

You’re missing a wraptag key:


     extract(lAtts(array(
         'label' => 'Articles',
         'labeltag' => '',
         'break' => 'br',
         'class' => '',
         'sep' => ': ',
         'status' => 'live',
         'wraptag' => '',
     ), $atts));

Offline

#11 2008-05-27 02:00:06

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: doWrap

I believe the way you’ve written your function using safe_count(), it will only return a single value, unless my memory of what select count() returns from the database is incorrect. The way you’ve written it will return one value for the status set. No list no ‘br’.

Someone correct me if I’m wrong.

Last edited by rsilletti (2008-05-27 02:01:23)

Offline

#12 2008-05-27 08:39:30

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: doWrap

^^ correct.

Offline

  1. Index
  2. » How do I…?
  3. » doWrap

Board footer

Powered by FluxBB