On 3/23/07, Németh Zoltán <[EMAIL PROTECTED]> wrote:
2007. 03. 23, péntek keltezéssel 17.30-kor Dwayne Heronimo ezt írta:
> YES this works thank nemeth:
your welcome but please call me Zoltán ;)
(my first name is Zoltán. in Hungary we write names the opposite order
than anywhere else ;) so that's why my mailbox is set to display 'Németh
Zoltán' but I sign my mails as 'Zoltán Németh' showing that my first
name is Zoltán and last name is Németh :) )
greets
Zoltán Németh
Ever thought of reversing it in your mailbox?
Or use a virtual name like me ;)
Tijnema
>
> <?php
> function previewString($showcatvar) {
>
> $minitxt = $showcatvar;
> $len = strlen($minitxt);
>
> if ($len > 235)
> {
> $len = 235;
> }
> else
> {
> $len = $len;
> }
>
> $newstring = substr($minitxt,0,$len);
>
> $previewtext = $newstring;
>
> return $previewtext;
> }
> ?>
>
> and to display it:
>
> <?php echo previewString($row_show_cat['text']); ?>
>
> cheers
>
> Dwayne
>
>
>
>
> ""Nmeth Zoltn"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > 2007. 03. 23, pntek keltezssel 16.55-kor Dwayne Heronimo ezt rta:
> >> Dear all,
> >>
> >> hmm.. sorry the $previewstext thing was a typo in my mail.
> >>
> >> But yes it is working but it will only display the first record of the
> >> recordset. I have like a list for items with short text in a page and of
> >> course made a query to make the database variables available. Which where
> >> the variable $row_show_cat['text']; comes from.
> >>
> >> This is why I thought that i may have to rewrite it into a function to
> >> display the $row_show_cat['text']; in a repeated reagion.
> >>
> >>
> >> I have rewritten my function:
> >>
> >> <?php
> >> function previewString($showcatvar) {
> >>
> >> $minitxt = $showcatvar;
> >> $len = strlen($minitxt);
> >>
> >> if ($len > 235)
> >> {
> >> $len = 235;
> >> }
> >> else
> >> {
> >> $len = $len;
> >> }
> >>
> >> $newstring = substr($minitxt,0,$len);
> >>
> >> $previewtext = $newstring;
> >>
> >> $previewtext = $whowcatvar;
> >
> > what is the meaning of the above line???
> > you are giving an undefined value (default NULL) to $previewtext, just
> > after you gave it the right value
> > delete that line and you might be well
> >
> > greets
> > Zoltn Nmeth
> >
> >>
> >> return $previewtext;
> >> }
> >> ?>
> >>
> >> And to to show it later in the page:
> >> <?php echo previewString($row_show_cat['text']); ?>
> >> but this still won't anywould display anything. :S
> >>
> >> Please let me know.
> >>
> >> ""Tijnema !"" <[EMAIL PROTECTED]> wrote in message
> >> news:[EMAIL PROTECTED]
> >> > On 3/23/07, Dwayne Heronimo <[EMAIL PROTECTED]> wrote:
> >> >> Dear All,
> >> >>
> >> >> I am very new to programming. I want to make a preview text that would
> >> >> display only a part of the text that is a text field in a database.
> >> >>
> >> >> //Begin Make preview string
> >> >>
> >> >> $minitxt = $row_show_cat['text'];
> >> >> $len = strlen($minitxt);
> >> >>
> >> >> if ($len > 235)
> >> >> {
> >> >> $len = 235;
> >> >> }
> >> >> else
> >> >> {
> >> >> $len = $len;
> >> >> }
> >> >>
> >> >> $newstring = substr($minitxt,0,$len);
> >> >>
> >> >> $previewtext = $newstring;
> >> >>
> >> >> //End Make preview string
> >> >>
> >> >> But if I want to display this somewhere in the page it will only
> >> >> display
> >> >> the
> >> >> first record of at every text column row <?php echo $previewstext ?>
> >> >>
> >> >> Althought I am very new to php and programming. I thought maybe I
> >> >> should
> >> >> rewrite it into a function. But my function won't work.
> >> >>
> >> >>
> >> >> function previewString($showcatvar) {
> >> >>
> >> >> $minitxt = $showcatvar;
> >> >> $len = strlen($minitxt);
> >> >>
> >> >> if ($len > 235)
> >> >> {
> >> >> $len = 235;
> >> >> }
> >> >> else
> >> >> {
> >> >> $len = $len;
> >> >> }
> >> >>
> >> >> $newstring = substr($minitxt,0,$len);
> >> >>
> >> >> $previewtext = $newstring;
> >> >>
> >> >> $previewtext = $whowcatvar;
> >> >>
> >> >> }
> >> >>
> >> >>
> >> >> and to display it in the page:
> >> >>
> >> >> <?php echo previewString($row_show_cat['text']) ?>
> >> >>
> >> >> IT displays notthing. But I think I am doing somthing wrong. I am
> >> >> assigning
> >> >> the wrong variables to the $row_show_cat['text']) ???
> >> >>
> >> >> Please let me know
> >> >
> >> > I'm currently not sure why your first piece of code isn't working, but
> >> > the second is quite simple. You aren't returning any variable in your
> >> > function, and so it won't output anything. Add the following:
> >> > return $previewtext;
> >> > Just before the }
> >> >
> >> > Then it will return something, but i think not what you wanted to :(
> >> >
> >> > Tijnema
> >> >>
> >> >> --
> >> >> PHP General Mailing List (http://www.php.net/)
> >> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >> >>
> >> >>
> >>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php