1
lawless007
help adding image to custom block...
  • 2005/3/5 3:57

  • lawless007

  • Just popping in

  • Posts: 5

  • Since: 2005/2/23


I have this custom block for PM's. Can anybody show me the correct code to add an image beside the text "Private Messages". I only want the image when they have a PM waiting. I know the html for adding an image, just don't know how to put it in correctly into this php code.


The Block:

global $xoopsUser;
if( 
$xoopsUser )
{
  
$pm_handler =& xoops_gethandler('privmessage');
  
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
  
$criteria->add(new Criteria('to_userid'$xoopsUser->getVar('uid')));
  
$pm $pm_handler->getCount($criteria);
}

if( 
$pm )
{
  echo 
"/xoop/html/viewpmsg.php" title="Read your new Private Messages">Private Messages($pm)n";
}
else
{
  echo 
"No new Private Messagesn";
}


Thank in advance for your help....

2
JasonMR
Re: help adding image to custom block...
  • 2005/3/5 4:29

  • JasonMR

  • Just can't stay away

  • Posts: 655

  • Since: 2004/6/21


if( $pm )
{
  echo 
"/xoop/html/viewpmsg.php" title="Read your new Private Messages">Private Messages($pm)n";
}
else
{
  echo 
"No new Private Messagesn";
}


...is where you need to focus on!

The first part (after if until else), is what gets displayed (printed on screen == echo), when messages are available, the other bit if not. In englisch the code says: "if there is a private message, do this, if not, do this".


So you just need to add the HTML for inserting an image somewhere inbetween this
"/xoop/html/viewpmsg.php" title="Read your new Private Messages">Private Messages($pm)n"

...though note, that
/n

...stands for new line....

HTH

3
Beejay
Re: help adding image to custom block...
  • 2005/3/5 4:34

  • Beejay

  • Quite a regular

  • Posts: 232

  • Since: 2004/6/5 2


Try this. Just change image.jpg to the image you want there. Don't put the "'s in or it won't work:

global $xoopsUser;
if( 
$xoopsUser )
{
  
$pm_handler =& xoops_gethandler('privmessage');
  
$criteria = new CriteriaCompo(new Criteria('read_msg'0));
  
$criteria->add(new Criteria('to_userid'$xoopsUser->getVar('uid')));
  
$pm $pm_handler->getCount($criteria);
}

if( 
$pm )
{
  echo 
"/xoop/html/viewpmsg.php" title="Read your new Private Messages">n";
}
else
{
  echo 
"No new Private Messagesn";
}

4
Beejay
Re: help adding image to custom block...
  • 2005/3/5 4:35

  • Beejay

  • Quite a regular

  • Posts: 232

  • Since: 2004/6/5 2


Was to slow. Sorry

5
JasonMR
Re: help adding image to custom block...
  • 2005/3/5 4:49

  • JasonMR

  • Just can't stay away

  • Posts: 655

  • Since: 2004/6/21


Never be sorry, when there is no reason!!!

You've done just fine, and with your addition, the user should be up and runnin' what he wants, in no time

6
lawless007
Re: help adding image to custom block...
  • 2005/3/6 2:10

  • lawless007

  • Just popping in

  • Posts: 5

  • Since: 2005/2/23


Thanks guys. That was it. Sometimes the answer is so simple but you can look to hard and never find it.

Thanks Again

Login

Who's Online

359 user(s) are online (272 user(s) are browsing Support Forums)


Members: 0


Guests: 359


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits