Render as HTML

I used to use an online database that allowed a field defiinition called "render as html".   What it did was simple - so for example if you had the code <a href="http://www.mysite.com">www.mysite.com</a> in that field, you would get a clickable url www.mysite.com in the results list.   Now I was thinking it would be really cool if we could have something like this for the HTML blocks that let you call one of our user defined fields.  There all all sorts of things that could be done with this.  For example, I am collecting member's Skype address in my site with a field called "SkypeID".    Now Skype has all kinds of buttons that you can use to "call now" so if there was some way to put that code into an html block, along with some kind of field designator - let's say <fieldname>, then all you would have to do would be to put the Skype button code in an html block, along with a field designator <SkypeID> and every member who had entered a Skype address could get a Skype "call me" button on their profile.  I can think of many other applications for this as well.  Would this be possible?  Instead of a "mod" per se, this would be a simple way to let us make our own mods.  I don't know if this would be easy, or hard, or impossible so would appreciate feedback from some of the coders here.

-

Thanks

-

Rob

Quote · 16 Sep 2008

I think I got a little long winded with this description, so let me ask the question in a simplier way.  Is it possible to "call" a profile field from an html block?  - similar to the way the email templates insert a field by putting it in brackets like <fieldname>?

-

The more I think about this, the more cool I think it would be- it would let people create their own simple mods.  I was just looking at the mod for adding a hyperlink to a field.  To use it, you have to replace about three major Dolphin files.  With this capability, you could just have a field called "website" and call that from within an html block, with the appropriate html code around it to make the link.

-

Not sure if I am making myself clear, but if anyone has an idea on how to make something like this work, I would sure like to hear it.

-

Cheers

-

Rob

Quote · 16 Sep 2008

Could someone at least tell me if the request I made in this post is understood - or have I confused everybody?  Is this theoretically possible?

-

Thanks

-

Rob

Quote · 17 Sep 2008

Hey, don't everyone rush in at once to help - I am getting a bit overwhelmed by all these responses!  Just kidding, but let me try again another way:
-
Let's say I have a text field in my member profile called "Website" (which I do).  Is there a way to put some code in the html block that will display this as a hyperlink?  I wrote tedwalther about this, and said he thought it was possible, but wanted to know if you can put php code in the html block.  I assume you can, as long as it is embedded in html, but don't know for sure- does anyone here?   Here is how Ted advised I post the problem so that coders here understand it:
-
I need help writing a small script for an HTML block that will pull web site URLs from my database and turn them into live links
-
Actually it is not just me.  This can't be more than a few lines of code so we could make it available to everyone here.  There is another mod out there that does this, but it takes a different approach - they keep the hyperlink in the profile field, and it involves altering several important Dolphin files.  This would be a simpler approach - you could just take the html block and drop it where ever you want. 
-
People who know me here know that I can be pretty persistant.  I generally just keep bashing my head against the wall, untill the wall gives way! - so if you want to save my bloody head please weigh in on this.
-
Thank you
-
Rob

Quote · 17 Sep 2008

rob, i would look at using the php block instead of the html block, and yes i think you can create a php block that would call a profile field. take a look at jtadeo's tutorial on php block, and see if you get any joy from that, since he has the code in there to call data from the database, maybe you can tweak it to suit what you are looking for.

as stated rob, dont know if this is the answer you are looking for, but read what you were saying, and that came to mind as a quick thought.

regards,

DosDawg

When a GIG is not enough --> Terabyte Dolphin Technical Support - Server Management and Support
Quote · 17 Sep 2008

First of all a disclaimer.... I really don't know how dolphin works; and quite possibly I don't ever want to know how it works.

In your specific example, why wouldn't you just hardcode the embed code or whatever code you are talking about in the PHP file that renders the Member's personal data on their profile page?  Sounds like you already have the variables (member ID, Skype ID etc..) you need at that point to make the proper substitutions to create the HTML.

In the generic sense...

I really don't know what variables are available to you, but could you add a custom PHP block, where the PHP code could make a DB query on a user's ID number and then render all of the custom HTML fields (DB records) that are associated with that user ID?

I am sort of working on a similar thing, but instead I am tying it to a Gallery2 website (instead of skype).  A dolphin userID is associated with a users Gallery2 g2_Item for their album.  Random pictures are pulled from the user's Gallery2 album/sub-albums and are they are turned into a slideshow (flash object) which are then displayed on the user's main profile page (using a custom PHP block).

Again, I don't really even use Dolphin.  I am researching social networking platforms and dolphin is one of many platforms that are part of my research.

Quote · 17 Sep 2008

Dosdawg - thanks for the idea - I didn't even know there was such thing as an "php block" - I'm not a programmer, but will look at jtadeo's tutorial and see if there is something I could hack.  One thing I still don't get though - why couldn't you just put the code within the html, then put it in an html block - wouldn't that work?

-

sruckh - thanks also for your response.  I think I expressed why I wouldn't just hardcode the field (besides the fact that I don't know how).   There is already a mod that does this for the profile fields- but it involved alterations to at least three major Dolphin files - another thing to keep track of when you have to do an upgrade, plus more complicated (I think) than what I have proposed.  Though I'm sure your approach of finding the User's ID number is on the right track.

-

Let me give another shot at expressing how I think this could work.  Suppose someone came up with some code that could be put in the html block - lets say it was designed for fields to be enclosed with double [[  ]] or  something like that.  Then, when a Dolphin developer wanted to refer to a field in an html block, he would just include that code (if it was needed there) and the field name expressed like this: [[fieldname]]  the program would then replace that with the actual value for that field.  So in the simple example I gave, a Dolphin developer might add code something like this to the html block: <a href="[[website]]">website link</a>.  The program would interpret [[website]] as the actual value of website in the members profile fields, and this code would display a hyperlink with the text "website link".

-

That is the most simple example I can think of - but one that would be very useful.  Plus if this technique could be made to work there are all sorts of things you could do- Skype buttons, Paypal buttons- whatever.   It would be kind of like having a "mod for making mods".  Thanks for your input so far- I will keep thinking about it.

-

Rob

Quote · 17 Sep 2008

Hi Rob

 

Code to display a link/Skype button and more, as we talk about...


Go to Admin/Builders/Fields Builder and Join Form:

 

Add NEW BLOCK, click on it and write as bellow

Name: Contact Information
Caption: Contact Information
Description:
Join Page: 0

SAVE
===============================


Add NEW ITEM and drop it bellow your NEW BLOCK(Contact Information), click on it and write as bellow

 

General area,
Name: SkypeStatus
Caption: Skype Status
Description: Your Skype ID
Type: Text


Advanced area,
Maximum value: 15

SAVE
===============================


Add NEW ITEM and drop it bellow your new Item 'SkypeStatus', click on it and write as bellow

 

General area,
Name: YahooStatus
Caption: Yahoo Status
Description: Your Yahoo username
Type: Text


Advanced area, 
Maximum value: 40

SAVE
===============================


Add NEW ITEM and drop it bellow your new Item 'YahooStatus', click on it and write as bellow

 

General area,
Name: ICQStatus
Caption: ICQ Status
Description: Your ICQ username
Type: Text


Advanced area,

Maximum value: 40

SAVE
===============================


Add NEW ITEM and drop it bellow your new Item 'ICQStatus', click on it and write as bellow

Name: Website
Caption: Website
Description: Your website name, WITHOUT http://
Type: Text

SAVE
===============================


Click on Edit Profile
---------------------

- Move new BLOCK Contact Information to active area

- Move new item SkypeStatus to active area and drop it bellow your new block 'Contact Information',
  do the same with item YahooStatus, ICQStatus and Website.

 (Do this for Owner and Admin)

=============================================
DON'T USE THIS Block or Items ON View Profile
=============================================


Go to Pages Builder, click on Profile and move your new block Contact Information and drop it bellow General Info
===============================


Go to phpMyAdmin and click on table PageCompose, find your new block (_FieldCaption_Contact Information_View) and click edit,

Edit Desc from 'Profile Fields Block' to Contact Information

Edit Func from 'PFBlock' to PHP

Edit Content: (delet the number you have there, '60' or something) and past code bellow to this area:

DON'T forget to change: DATABASE_USER, DATABASE_PASSWORD and DATABASE_NAME
==========================================================================


$profileID = getID( $_REQUEST['ID'] );

$my_dbHost="localhost";
$my_dbLogin="DATABASE_USER";
$my_dbPass="DATABASE_PASSWORD";
$my_db="DATABASE_NAME";

$connection=mysql_connect("$my_dbHost","$my_dbLogin","$my_dbPass") or die("Couldn't connect to the server.");

$db=mysql_select_db("$my_db", $connection) or die("Couldn't select a database.");

$sql="SELECT * FROM Profiles WHERE ID='$profileID'";

$sql_result=mysql_query($sql,$connection) or die("Couldn't execute query!");
$res=mysql_fetch_array($sql_result);

$SkypeStatus=$res["SkypeStatus"];
$YahooStatus=$res["YahooStatus"];
$ICQStatus=$res["ICQStatus"];
$Website=$res["Website"];


echo "<div class=\"boxContent\">";
echo "<table class=\"profile_info_block\" cellspacing=0 cellpadding=1>";


if( strlen($SkypeStatus) > 0 )
{
echo "<tr>
<td class=\"profile_info_label\">Skype Status:</td>
<td class=\"profile_info_value\" >
<script type=\"text/javascript\" src=\"http://download.skype.com/share/skypebuttons/js/skypeCheck.js\"></script>
<a href=\"skype:$SkypeStatus?chat\">
<img src=\"http://mystatus.skype.com/smallicon/$SkypeStatus\" style=\"border: none;\" width=16 height=16 alt=\"My status\"></a></td></tr>";
}


if( strlen($YahooStatus) > 0 )
{
echo "<tr><td class=\"profile_info_label\">Yahoo Status:</td>
<td class=\"profile_info_value\">
<a href=\"ymsgr:sendIM?$YahooStatus\" target=\"_blank\">
<img border=0 src=\"http://opi.yahoo.com/online?u=$YahooStatus&m=g&t=0\"></a>
</td></tr>";
}


if( strlen($ICQStatus) > 0 )
{
echo "<tr><td class=\"profile_info_label\">ICQ Status:</td>
<td class=\"profile_info_value\" >
<a href=\"http://people.icq.com/people/about_me.php?uin=$ICQStatus\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?web=$ICQStatus&img=21\" width=57 height=15></a></td></tr>";
}


if( strlen($Website) > 0 )
{
echo "<tr><td class=\"profile_info_label\"><br />My website:</td>
<td class=\"profile_info_value\" ><br />
<a href=\"http://$Website\" target=\"_blank\"><b>$Website</b></a>
</td></tr>";
}


if( strlen($SkypeStatus) < 1 AND strlen($YahooStatus) < 1 AND strlen($ICQStatus) < 1 AND strlen($Website) < 1)
{
echo "<tr><td class=\"profile_info_label\"></td><td class=\"profile_info_value\" ><b>No contact information available</b></td></tr>";
}

echo "</table>";
echo "</div>";

mysql_close($connection);
====

SAVE it

 

===============================
Go to Admin/Builders/Pages Builder and move block 'Contact Information'

IMPORTEN: After edit/save table 'Content' inside DB,
you ALWAYS have to move block in Pages Builder some before it will show last edit you do.
===============================


Go to Settings/Languages settings and add nessesarry languages strengs on Join, Edit and View Profile pages..
===============================

 

Log in as a user and edit your profile data on Skype/Yahoo/ICQ Status and My website,
view your profile and you will now see a new block with you information inside.

 

Cheers,
Ottar

Quote · 24 Sep 2008

Wow - above and beyond the call of duty, as always Ottar.  I can't wait to try this.  I'm sure I will have questions, but I really appreciate the spirit of sharing that you bring to these forums.

-

Rob

Quote · 24 Sep 2008

Yes wow Ottar if that works its awesome !

You competing with MrP for most helpful member? :-)

I love the way Dolphin can be made to do almost anything !

Let us know how you go with this one Rob.

Thanks

Dan V

Quote · 25 Sep 2008

Ottar,

I tried your mod, only to set up Website and Email links. I modified the database as you suggested, but the Website and email do not appear as links on the member pages.

I'm wondering what I could have missed.

- D

Quote · 24 Nov 2008

Not sure what you have done...

Post code you saved to your database.

 

(Take away your DB username and password.)

Quote · 24 Nov 2008

Sorry about that. Here's the phpmyadmin bit:

$profileID = getID( $_REQUEST['ID'] );

$my_dbHost="localhost";
$my_dbLogin="DATABASE_USER";
$my_dbPass="DATABASE_PASSWORD";
$my_db="DATABASE_NAME";

$connection=mysql_connect("$my_dbHost","$my_dbLogin","$my_dbPass") or die("Couldn't connect to the server.");

$db=mysql_select_db("$my_db", $connection) or die("Couldn't select a database.");

$sql="SELECT * FROM Profiles WHERE ID='$profileID'";

$sql_result=mysql_query($sql,$connection) or die("Couldn't execute query!");
$res=mysql_fetch_array($sql_result);

$Website=$res["Website"];
$Email=$res["Email"];


echo "<div class=\"boxContent\">";
echo "<table class=\"profile_info_block\" cellspacing=0 cellpadding=1>";



if( strlen($Website) > 0 )
{
echo "<tr><td class=\"profile_info_label\"><br />Website:</td>
<td class=\"profile_info_value\" ><br />
<a href=\"http://$Website\" target=\"_blank\"><b>$Website</b></a>
</td></tr>";
}

if( strlen($Email) > 0 )
{
echo "<tr><td class=\"profile_info_label\"><br />Email:</td>
<td class=\"profile_info_value\" ><br />
<a href=\"http://mailto:$Email\" target=\"_blank\"><b>$Email</b></a>
</td></tr>";
}


if( strlen($Website) < 1 AND strlen($Email) < 1)
{
echo "<tr><td class=\"profile_info_label\"></td><td class=\"profile_info_value\" ><b>No contact information available</b></td></tr>";
}

----

D

Quote · 25 Nov 2008

Oops. Failed to copy this on the end:

echo "</table>";
echo "</div>";

mysql_close($connection);

Any help you can give would be very much appreciated. thanks for looking.

- D

Quote · 25 Nov 2008

hi there, i've copied the whole code just as stated and change the db info, but still, it doesn't work. am i missing something here? thanks

Quote · 9 Dec 2008

What doesn't work!!

 

Have you do everything what I write in my post!!

Quote · 9 Dec 2008

yeah, i dunno if i'm missing something. but after i did what is posted here, it only displayed a plain text and not a link that was supposed to be...

Quote · 10 Dec 2008

Code only with website and email, edit some code.

Check over it, hope everything will work for you now.

Ottar

 

(Dol.Vers.6.1.2 - 6.1.4)

 

Add NEW BLOCK, click on it and write as bellow

Name: Contact Information
Caption: Contact Information
Description:
Join Page: 0

SAVE
===============================

 

Add NEW ITEM and drop it bellow your NEW BLOCK (Contact Information), click on it and write as bellow

 

Name: Website
Caption: Website
Description: Your biz website, WITHOUT http://
Type: Text

SAVE
===============================

 

Add NEW ITEM and drop it bellow your new Item 'Website', click on it and write as bellow

Name: Mail
Caption: Mail
Description: Your biz Email
Type: Text

SAVE
===============================

 

Click on Edit Profile

- Move new BLOCK Contact Information to active area

- Move new item Website and Email to active area and drop it bellow your new block 'Contact Information',
   (Do this for Owner and Admin)

================================

 

Go to Pages Builder

click on Profile and move your new block Contact Information and drop it bellow General Info

================================


Go to phpMyAdmin

and click on table PageCompose, find your new block (_FieldCaption_Contact Information_View) and click edit,

 

Edit Desc from 'Profile Fields Block' to Contact Information

Edit Func from 'PFBlock' to PHP

Edit Content: (delet the number you have there, '60' or something) and past code bellow to this area:

 

$profileID = getID( $_REQUEST['ID'] );

 

$arr = db_arr("SELECT `Website`, `Mail` FROM Profiles WHERE ID = '$profileID'");

 

echo "

<table class=\"profile_info_block\" cellspacing=0 cellpadding=1>
<tr>

<td class=\"profile_info_label\">My website:</td>

<td class=\"profile_info_value\" >

<a href=\"http://{$arr['Website']}\" target=\"_blank\"><b>{$arr['Website']}</b></a>

</td>
</tr>
<tr>
<td class=\"profile_info_label\">My Email:</td>
<td class=\"profile_info_value\" >
<a href=\"mailto:{$arr['Mail']}\"><b>{$arr['Mail']}</b></a>

</td>
</tr>
</table>

";

 

SAVE

===============================


Go to Admin/Builders/Pages Builder and move block 'Contact Information'

IMPORTEN: After edit/save 'Content' inside DB,
you ALWAYS have to move block in Pages Builder some before it will show last edit you do.
===============================

 

Go to Settings/Languages settings and add nessesarry languages strengs

on Join, Edit and View Profile pages..
===============================

 

Login as a user and edit your profile data on website and email

 

Now you can look at your site.

Quote · 10 Dec 2008

okweb, thanks for your time and patience. it's now working.

one question though, how can i make the website block to accept multiple links?

thanks

Quote · 12 Dec 2008

I would imagine that you will have to make a new field - i.e. website2 or something like that, then follow his same procedure.

Quote · 12 Dec 2008

yes, but what i mean is that the other block is dynamic, wherein the user can specify how many website they had then it will have that number of blocks..

Quote · 15 Dec 2008

Works GREAT THANKS!

Quote · 30 Mar 2009

Hi Rob

Code to display a link/Skype button and more, as we talk about...


Go to Admin/Builders/Fields Builder and Join Form:

Add NEW BLOCK, click on it and write as bellow

Name: Contact Information
Caption: Contact Information
Description:
Join Page: 0

SAVE
===============================


Add NEW ITEM and drop it bellow your NEW BLOCK(Contact Information), click on it and write as bellow

General area,
Name: SkypeStatus
Caption: Skype Status
Description: Your Skype ID
Type: Text


Advanced area,
Maximum value: 15

SAVE
===============================


Add NEW ITEM and drop it bellow your new Item 'SkypeStatus', click on it and write as bellow

General area,
Name: YahooStatus
Caption: Yahoo Status
Description: Your Yahoo username
Type: Text


Advanced area, 
Maximum value: 40

SAVE
===============================


Add NEW ITEM and drop it bellow your new Item 'YahooStatus', click on it and write as bellow

General area,
Name: ICQStatus
Caption: ICQ Status
Description: Your ICQ username
Type: Text


Advanced area,

Maximum value: 40

SAVE
===============================


Add NEW ITEM and drop it bellow your new Item 'ICQStatus', click on it and write as bellow

Name: Website
Caption: Website
Description: Your website name, WITHOUT http://
Type: Text

SAVE
===============================


Click on Edit Profile
---------------------

- Move new BLOCK Contact Information to active area

- Move new item SkypeStatus to active area and drop it bellow your new block 'Contact Information',
do the same with item YahooStatus, ICQStatus and Website.

(Do this for Owner and Admin)

=============================================
DON'T USE THIS Block or Items ON View Profile
=============================================


Go to Pages Builder, click on Profile and move your new block Contact Information and drop it bellow General Info
===============================


Go to phpMyAdmin and click on table PageCompose, find your new block (_FieldCaption_Contact Information_View) and click edit,

Edit Desc from 'Profile Fields Block' to Contact Information

Edit Func from 'PFBlock' to PHP

Edit Content: (delet the number you have there, '60' or something) and past code bellow to this area:

DON'T forget to change: DATABASE_USER, DATABASE_PASSWORD and DATABASE_NAME
==========================================================================


$profileID = getID( $_REQUEST['ID'] );

$my_dbHost="localhost";
$my_dbLogin="DATABASE_USER";
$my_dbPass="DATABASE_PASSWORD";
$my_db="DATABASE_NAME";

$connection=mysql_connect("$my_dbHost","$my_dbLogin","$my_dbPass") or die("Couldn't connect to the server.");

$db=mysql_select_db("$my_db", $connection) or die("Couldn't select a database.");

$sql="SELECT * FROM Profiles WHERE ID='$profileID'";

$sql_result=mysql_query($sql,$connection) or die("Couldn't execute query!");
$res=mysql_fetch_array($sql_result);

$SkypeStatus=$res["SkypeStatus"];
$YahooStatus=$res["YahooStatus"];
$ICQStatus=$res["ICQStatus"];
$Website=$res["Website"];


echo "<div class=\"boxContent\">";
echo "<table class=\"profile_info_block\" cellspacing=0 cellpadding=1>";


if( strlen($SkypeStatus) > 0 )
{
echo "<tr>
<td class=\"profile_info_label\">Skype Status:</td>
<td class=\"profile_info_value\" >
<script type=\"text/javascript\" src=\"http://download.skype.com/share/skypebuttons/js/skypeCheck.js\"></script>
<a href=\"skype:$SkypeStatus?chat\">
<img src=\"http://mystatus.skype.com/smallicon/$SkypeStatus\" style=\"border: none;\" width=16 height=16 alt=\"My status\"></a></td></tr>";
}


if( strlen($YahooStatus) > 0 )
{
echo "<tr><td class=\"profile_info_label\">Yahoo Status:</td>
<td class=\"profile_info_value\">
<a href=\"ymsgr:sendIM?$YahooStatus\" target=\"_blank\">
<img border=0 src=\"http://opi.yahoo.com/online?u=$YahooStatus&m=g&t=0\"></a>
</td></tr>";
}


if( strlen($ICQStatus) > 0 )
{
echo "<tr><td class=\"profile_info_label\">ICQ Status:</td>
<td class=\"profile_info_value\" >
<a href=\"http://people.icq.com/people/about_me.php?uin=$ICQStatus\" target=\"_blank\"><img src=\"http://status.icq.com/online.gif?web=$ICQStatus&img=21\" width=57 height=15></a></td></tr>";
}


if( strlen($Website) > 0 )
{
echo "<tr><td class=\"profile_info_label\"><br />My website:</td>
<td class=\"profile_info_value\" ><br />
<a href=\"http://$Website\" target=\"_blank\"><b>$Website</b></a>
</td></tr>";
}


if( strlen($SkypeStatus) < 1 AND strlen($YahooStatus) < 1 AND strlen($ICQStatus) < 1 AND strlen($Website) < 1)
{
echo "<tr><td class=\"profile_info_label\"></td><td class=\"profile_info_value\" ><b>No contact information available</b></td></tr>";
}

echo "</table>";
echo "</div>";

mysql_close($connection);
====

SAVE it

===============================
Go to Admin/Builders/Pages Builder and move block 'Contact Information'

IMPORTEN: After edit/save table 'Content' inside DB,
you ALWAYS have to move block in Pages Builder some before it will show last edit you do.
===============================


Go to Settings/Languages settings and add nessesarry languages strengs on Join, Edit and View Profile pages..
===============================

Log in as a user and edit your profile data on Skype/Yahoo/ICQ Status and My website,
view your profile and you will now see a new block with you information inside.

Cheers,
Ottar

Greet !! Work also for D7 !! Thank you so much Okweb !!

...
Quote · 28 Jan 2010

Ok, my bad... doesn't work complety...

when i ceck my hown profile, all good... but when i look at the other profiles, there is a problem, an error message with mysql-realtime (i forgot to copy) and the page have problem...

The problem is when i edit the sys_pagecompose table :

Edit Func from 'PFBlock' to PHP.. looks like the php comand give me problem...

...
Quote · 29 Jan 2010

Didn't someone make a mod for this? I can't find it in the market.

Quote · 4 Dec 2010
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.