Custom Fields & Blocks Question


Topic author
the.ronin
Valued Contributor
Posts: 64
Joined: 30. October 2008 16:20

Custom Fields & Blocks Question

Post by the.ronin »

I have created a custom field in the ACP. How would I call on that field in a custom block?

Any guidance would be greatly appreciated.
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: Custom Fields & Blocks Question

Post by Kevin »

Need more information.
You have already created a DB entry for this custom field? What do you want to do exactly?
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
the.ronin
Valued Contributor
Posts: 64
Joined: 30. October 2008 16:20

Re: Custom Fields & Blocks Question

Post by the.ronin »

Hi Kevin,

Ok, so created a custom field in the phpBB admin control panel under “Users & Groups” and “custom Profile Fields”. It is a text field where users select from a dropdown box “movie1,” “movie2,” etc.

The custom field was named through the admin control panel as “custom_movie.”

I had originally tried to recycle one of the portal php and html files to do this. I chose the random member block. I deleted everything I thought I didn’t need from the php file and included a call to the custom field. I included the php file into portal.php.

I know now that custom fields made through the ACP are not in USERS_TABLE but I am posting this for reference ...

Code: Select all

<?php

if (!defined('IN_PHPBB'))
{
   exit;
}

if (!defined('IN_PORTAL'))
{
   exit;
}

   switch ($db->sql_layer)
   {
      case 'postgres':
         $sql = 'SELECT *
         FROM ' . USERS_TABLE . '
         WHERE user_type <> ' . USER_IGNORE . '
         AND user_type <> ' . USER_INACTIVE . '
         ORDER BY RANDOM()';
      break;
   
      case 'mssql':
      case 'mssql_odbc':
         $sql = 'SELECT *
         FROM ' . USERS_TABLE . '
         WHERE user_type <> ' . USER_IGNORE . '
         AND user_type <> ' . USER_INACTIVE . '
         ORDER BY NEWID()';
      break;
   
      default:
         $sql = 'SELECT *
         FROM ' . USERS_TABLE . '
         WHERE user_type <> ' . USER_IGNORE . '
         AND user_type <> ' . USER_INACTIVE . '
         ORDER BY RAND()';
      break;
   }

$result = $db->sql_query_limit($sql, 1);
$row = $db->sql_fetchrow($result);

$new_field = $row['custom_movie'];

$template->assign_block_vars('my_movie', array(
   'MOVIE_ID'      => $new_field,
));

$db->sql_freeresult($result);

?>
Now in the html portal block, I want to include that user’s specific custom field into an <object> that pulls up a specific flash movie based on that custom field

Code: Select all

<embed src="http://www.website.com/flashmovie.swf?movieID={my_movie.MOVIE_ID}" ...
 
I know I have likely butchered this coding pretty bad. I do not know html nor php very well so please do not be insulted by it.

Just any help would be very very very appreciated.
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: Custom Fields & Blocks Question

Post by Kevin »

So if i got you right, the code should be something like this:

Code: Select all

    <?php

    if (!defined('IN_PHPBB'))
    {
       exit;
    }

    if (!defined('IN_PORTAL'))
    {
       exit;
    }

            $sql = "SELECT custom_movie
                    FROM " . PROFILE_FIELDS_DATA_TABLE . "
                    WHERE user_id = " . $user->data['user_id'];

                $result = $db->sql_query_limit($sql, 1);
                $my_movie     = $db->sql_fetchfield('custom_movie');
                $db->    sql_freeresult($result);

        $template->assign_vars(array(
            'MOVIE_ID'     => (!empty($my_movie)) ? $my_movie : '666', // Change 666 to your wanted default movie ID if none is set
        ));

    ?>
and the template part:

Code: Select all

    <embed src="http://www.website.com/flashmovie.swf?movieID={MOVIE_ID}" ... 
That should do the trick. Let me know if it works. ;)
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
the.ronin
Valued Contributor
Posts: 64
Joined: 30. October 2008 16:20

Re: Custom Fields & Blocks Question

Post by the.ronin »

Holy cow, so I was actually pretty close??? This is how I go about with my modifications. I see something the website is doing and I tweak that to see if it will do what I want it to. I understand close to nothing of coding.

Thank you!! I will try this as soon as I get home. Really, thank you very much Kevin. Anywhere else and I get accused of not reading threads or tutorials. I read them all – I just don’t understand them.

You even included code to default if there is no ID ... man you rock!!
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: Custom Fields & Blocks Question

Post by Kevin »

You're welcome! :)
But let's see if it works the way you want it to. ;)
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
the.ronin
Valued Contributor
Posts: 64
Joined: 30. October 2008 16:20

Re: Custom Fields & Blocks Question

Post by the.ronin »

Even if it doesn’t work – you’ve been way more helpful than other places.

I don’t mean to push my luck here, but if I might mention one more thing ...

So the flash movie needs 2 parameters. MOVIE_ID which is a text string and also a MOVIE_ID# which is a number. The same ID# always corresponds to the same ID text.

I’ve defined the MOVIE_ID text in the custom profiles. I thought the coding might be too difficult for it to store the corresponding number whenever an ID is chosen.

So I planned to create nested <!--- IF / ELSE statements in the html. If the MOVIE_ID equaled a particular text string, then the embed flash movie code would contain that ID and the corresponding ID#.

Would it be best to do this in the html or in the php file? What would that code look like? Also, there are 27 possible MOVIE_IDs.

Again, I don’t mean to push my luck here since you’ve been so helpful but I figured might as well try.

In any event, if this all works, I will share what everything on these forums. It’s a custom WaveWatch surf report block.

Topic author
the.ronin
Valued Contributor
Posts: 64
Joined: 30. October 2008 16:20

Re: Custom Fields & Blocks Question

Post by the.ronin »

Well I did end up getting an error ...
General Error
SQL ERROR [ mysqli ]

Unknown column 'wwatch_region' in 'field list' [1054]

SQL

SELECT wwatch_region FROM phpbb_profile_fields_data WHERE user_id = 2 LIMIT 1

BACKTRACE

FILE: includes/db/mysqli.php
LINE: 143
CALL: dbal->sql_error()

FILE: includes/db/mysqli.php
LINE: 185
CALL: dbal_mysqli->sql_query()

FILE: includes/db/dbal.php
LINE: 159
CALL: dbal_mysqli->_sql_query_limit()

FILE: portal/block/wwatch.php
LINE: 27
CALL: dbal->sql_query_limit()

FILE: portal.php
LINE: 248
CALL: include('portal/block/wwatch.php')
I've made sure that custom field "wwatch_region" is set through the admin control panel. I tried various tables including profile_fields, postrow.custom_fields, and other permutations with the same error. I also tried just searching through the tables in phpMySql panel. Same error.

Here the code from "wwatch.php" which is included in portal.php ...

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: random_member.php 325 2008-08-17 18:59:40Z kevin74 $
* @copyright (c) kevin / saint ( www.board3.de/ ), (c) Ice, (c) nickvergessen ( www.flying-bits.org/ ), (c) redbull254 ( www.digitalfotografie-foren.de ), (c) Christian_N ( www.phpbb-projekt.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB'))
    {
       exit;
    }

if (!defined('IN_PORTAL'))
	{
       exit;
    }

            $sql = "SELECT wwatch_region
                    FROM " . PROFILE_FIELDS_DATA_TABLE . "
                    WHERE user_id = " . $user->data['user_id'];

                $result = $db->sql_query_limit($sql, 1);
                $region_name     = $db->sql_fetchfield('wwatch_region');
                $db->    sql_freeresult($result);

        $template->assign_vars(array(
            'WWATCH_REGION'     => (!empty($region_name)) ? $region_name : '666', // Change 666 to your wanted default movie ID if none is set
        ));

 ?>
Any help would once again be greatly appreciated.
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: Custom Fields & Blocks Question

Post by Kevin »

Take a look directly in the table (MySQLDumper or phpMyAdmin), if this field exists or how it is named.
This seems to be a clear error message: "Unknown column 'wwatch_region' in 'field list' [1054]"
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
the.ronin
Valued Contributor
Posts: 64
Joined: 30. October 2008 16:20

Re: Custom Fields & Blocks Question

Post by the.ronin »

I found it in phpbb_profile_fields as well as phpbb_log and phpbb_template_data. I'm assuming profile_fields is the appropriate table holding the actual data?

I changed the code to read:

Code: Select all

            $sql = "SELECT wwatch_region
                    FROM " . PHPBB_PROFILE_FIELDS . "
                    WHERE user_id = " . $user->data['user_id'];

                $result = $db->sql_query_limit($sql, 1);
                $region_name     = $db->sql_fetchfield('wwatch_region');
                $db->    sql_freeresult($result);

        $template->assign_vars(array(
            'WWATCH_REGION'     => (!empty($region_name)) ? $region_name : '666', // Change 666 to your wanted default movie ID if none is set
        ));
... and now I am getting this error:
General Error
SQL ERROR [ mysqli ]

Unknown column 'wwatch_region' in 'field list' [1054]

SQL

SELECT wwatch_region FROM PHPBB_PROFILE_FIELDS WHERE user_id = 2 LIMIT 1

BACKTRACE

FILE: includes/db/mysqli.php
LINE: 143
CALL: dbal->sql_error()

FILE: includes/db/mysqli.php
LINE: 185
CALL: dbal_mysqli->sql_query()

FILE: includes/db/dbal.php
LINE: 159
CALL: dbal_mysqli->_sql_query_limit()

FILE: portal/block/wwatch.php
LINE: 27
CALL: dbal->sql_query_limit()

FILE: portal.php
LINE: 248
CALL: include('portal/block/wwatch.php')
I don't know what it means by "unknown column"? In case it is helpful, here is screenshot of the field structure in the table:

Image

Thanks again for continuing to help me on this, Kevin.

Topic author
the.ronin
Valued Contributor
Posts: 64
Joined: 30. October 2008 16:20

Re: Custom Fields & Blocks Question

Post by the.ronin »

Kevin, I think I made a huge step forward here ...

I kept digging around in phpMyAdmin and finally found that the field was actually "pf_wwatch_region". The "pf_" was appended to it for whatever reason - I assume that stands for "profile field". So now it IS pulling that field.

But what I do notice though is that it is pulling a number and not the text - and it seems to correspond with where that choice is on the list. So if I pick the first choice, "California", what the html output shows is "1". If I pick Hawaii, the second choice, it shows 2.

What do you think that's about??

This might actually work in my favor though ... as I mentioned earlier, I have 27 choices. I could have a "if pf_wwatch_region = 1 then region_name = "California" type thing.

Could you suggest how that code might look like in html or php?

Thank you again for everything!

Topic author
the.ronin
Valued Contributor
Posts: 64
Joined: 30. October 2008 16:20

Re: Custom Fields & Blocks Question

Post by the.ronin »

KEVIN, IT'S WORKING!!!!!!! :D :D :D :D I am able to click on any one of SIXTY FOUR regions and it shows up perfectly in my portal block!! Thank you sir!!! :D :D :D

There is just one LAST thing ... rather than defaulting to a region #, I just want it to show a message saying that they can set their surf report in the control panel. I think to do that I can use something like this code:

Code: Select all

if ($region_name == 0)
{
$template->assign_vars(array(
	'S_NO_WWATCH' => true,
));
}
... where in the html I can use ...

Code: Select all

<!-- IF S_NO_WWATCH -->
Set your WaveWatch surf report region in the control panel.
<!-- ENDIF -->
Would this work if the user has not set his region yet? Would it be a value of 0?

Also in the html, how would I make it skip trying to retrieve the movie? I set 0 to 1 and it is definitely tripping the S_NO_WWATCH, but it is still showing the movie.

Thanks again!

Topic author
the.ronin
Valued Contributor
Posts: 64
Joined: 30. October 2008 16:20

Re: Custom Fields & Blocks Question

Post by the.ronin »

Guys, really sorry for all the double posting here ... but I think I FINALLY got it.

My last question is whether if someone does not set the custom field, does it have a value of 0? If so this coding may work. What do you think, Kevin?

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: random_member.php 325 2008-08-17 18:59:40Z kevin74 $
* @copyright (c) kevin / saint ( www.board3.de/ ), (c) Ice, (c) nickvergessen ( www.flying-bits.org/ ), (c) redbull254 ( www.digitalfotografie-foren.de ), (c) Christian_N ( www.phpbb-projekt.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB'))
    {
       exit;
    }

if (!defined('IN_PORTAL'))
	{
       exit;
    }

$sql = "SELECT pf_wwatch_region FROM " . PROFILE_FIELDS_DATA_TABLE . " WHERE user_id = " . $user->data['user_id'];
$result = $db->sql_query_limit($sql, 1);
$region_name     = $db->sql_fetchfield('pf_wwatch_region');
$db->    sql_freeresult($result);

if ($region_name == 0)
{
$template->assign_vars(array(
	'S_NO_WWATCH' => true,
));
}
else
{
$template->assign_vars(array(
	'S_SET_WWATCH' => true,
));
}
if ($region_name == 1)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Washington',
));
}
if ($region_name == 2)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Oregon',
));
}

*** DELETED CODE BECAUSE IT IS CRAZY LONG FOR PURPOSES OF THIS POST ****

if ($region_name == 64)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Portugal',
));
}

$template->assign_vars(array(
	'WWATCH_REGION'     => $region_name
));

 ?>
Then in my html block file ...

Code: Select all

<!--version $Id: links.html 236 2008-05-18 15:50:06Z kevin74 $ //-->
<div class="portal-panel">
	<div class="inner">
		<span class="portal-corners-top"><span></span></span>
			<h3>Surf Report</h3>
			<div><br />
			<!-- IF S_NO_WWATCH -->
			Set your WaveWatch surf report region in the control panel.
			<!-- ENDIF -->
			<!-- IF S_SET_WWATCH -->
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="180" height="153"><param name="movie" value="http://www.wavewatch.com/flash_tools/current_magnet.swf?theLocation={WWATCH_REGION}&city={WWATCH_LOC}" /><param name="quality" value="high" /><param name="wmode" value="transparent"><embed src="http://www.wavewatch.com/flash_tools/current_magnet.swf?theLocation={WWATCH_REGION}&city={WWATCH_LOC}" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="180" height="153"></embed></object>
			<!-- ENDIF -->
			</div>
			<br />
		<span class="portal-corners-bottom"><span></span></span>
	</div>
</div>
<br style="clear:both" />
Watcha think?? Seems to be working perfectly fine on my testing! :D :D


[edit] Well I logged off my site and checked the portal ... sure enough it directed me to the control panel and NO movie was loaded!! I think it's done!! Thanks again Kevin!! :D :D

When I clean this up, I will run it by you to see if it is worth including in your mods section. Might a bit too simplistic compared to the other mods but I love it.
User avatar

Kevin
Site Admin
Posts: 2989
Joined: 7. January 2006 20:11
phpBB.de User: Saint
phpBB.com User: Saint_hh
Location: Hamburg
Contact:

Re: Custom Fields & Blocks Question

Post by Kevin »

Gorgeous, fantastic! :D
I'm fascinated by the possibilities of the custom fields together with custom blocks. I already have made one (german) for weather forecasts, depending on the zip-code of the users: viewtopic.php?f=21&t=937
That's the reason why i was so fast with the answer, i already had a nearly similar idea. ;)

You have to show us the complete final code - i'd like to see it (and a demo would be perfect). ;)

Regarding your question:
I would try after the query:

Code: Select all

if (!empty($region_name))
    {
           your code
    }
else
    {
           $template->assign_vars(array(
           'S_NO_WWATCH' => true,
           ));
    } 
edit:
Okay, i saw your edit, you've got it.
Congratulations! :)
~~~ They say the definition of madness is doing the same thing and expecting a different result ~~~

Kein Support per PN / No support via PM!

Topic author
the.ronin
Valued Contributor
Posts: 64
Joined: 30. October 2008 16:20

Re: Custom Fields & Blocks Question

Post by the.ronin »

Kevin wrote:I already have made one (german) for weather forecasts, depending on the zip-code of the users: viewtopic.php?f=21&t=937
That's the reason why i was so fast with the answer, i already had a nearly similar idea. ;)

You have to show us the complete final code - i'd like to see it (and a demo would be perfect). ;)
Oh man, I wish I spoke German! All I know is auf weidersehen and that's because it was in a Volkswagen ad and I am a VW enthusiast. :lol:

Ok here is the full code. Bear with it because it is going through 64 different region settings ...

Code: Select all

<?php

/**
*
* @package - Board3portal
* @version $Id: random_member.php 325 2008-08-17 18:59:40Z kevin74 $
* @copyright (c) kevin / saint ( www.board3.de/ ), (c) Ice, (c) nickvergessen ( www.flying-bits.org/ ), (c) redbull254 ( www.digitalfotografie-foren.de ), (c) Christian_N ( www.phpbb-projekt.de )
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*
*/

if (!defined('IN_PHPBB'))
    {
       exit;
    }

if (!defined('IN_PORTAL'))
	{
       exit;
    }

$sql = "SELECT pf_wwatch_region FROM " . PROFILE_FIELDS_DATA_TABLE . " WHERE user_id = " . $user->data['user_id'];
$result = $db->sql_query_limit($sql, 1);
$region_name     = $db->sql_fetchfield('pf_wwatch_region');
$db->    sql_freeresult($result);

if ($region_name == 0)
{
$template->assign_vars(array(
	'S_NO_WWATCH' => true,
));
}
else
{
$template->assign_vars(array(
	'S_SET_WWATCH' => true,
));
}
if ($region_name == 1)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Washington',
));
}
if ($region_name == 2)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Oregon',
));
}
if ($region_name == 3)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Central Cal',
));
}
if ($region_name == 4)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Norcal',
));
}
if ($region_name == 5)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'S. CA (SB/Ventura)',
));
}
if ($region_name == 6)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'S. CA (Los Angeles)',
));
}
if ($region_name == 7)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'S. CA (Orange County)',
));
}
if ($region_name == 8)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'S. CA (San Diego)',
));
}
if ($region_name == 9)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'NE (Cape to Maine)',
));
}
if ($region_name == 10)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'NE (LI to NJ)',
));
}
if ($region_name == 11)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'C.East (MD to VA)',
));
}
if ($region_name == 12)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Central East (OBX)',
));
}
if ($region_name == 13)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Southeast',
));
}
if ($region_name == 14)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Florida East Coast',
));
}
if ($region_name == 15)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Florida Gulf',
));
}
if ($region_name == 16)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Texas',
));
}
if ($region_name == 17)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Hawaii (North Shore)',
));
}
if ($region_name == 18)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Hawaii (South Shore)',
));
}
if ($region_name == 19)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'British Columbia',
));
}
if ($region_name == 20)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Nova Scotia',
));
}
if ($region_name == 21)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Baja',
));
}
if ($region_name == 22)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Mainland Mexico',
));
}
if ($region_name == 23)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Costa Rica',
));
}
if ($region_name == 24)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Panama',
));
}
if ($region_name == 25)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Ecuador',
));
}
if ($region_name == 26)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Peru',
));
}
if ($region_name == 27)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Peru South/Chile North',
));
}
if ($region_name == 28)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Chile Central',
));
}
if ($region_name == 29)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Chile South',
));
}
if ($region_name == 30)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Brazil North',
));
}
if ($region_name == 31)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Brazil Northeast',
));
}
if ($region_name == 32)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Brazil Bahia',
));
}
if ($region_name == 33)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Brazil Southeast',
));
}
if ($region_name == 34)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Brazil South',
));
}
if ($region_name == 35)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Argentina',
));
}
if ($region_name == 36)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Fiji',
));
}
if ($region_name == 37)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Tonga',
));
}
if ($region_name == 38)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Tahiti',
));
}
if ($region_name == 39)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Gold Coast',
));
}
if ($region_name == 40)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'S. East (Sydney)',
));
}
if ($region_name == 41)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'West (Geraldton)',
));
}
if ($region_name == 42)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'S. West (Margaret River)',
));
}
if ($region_name == 43)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Victoria/Tasmania',
));
}
if ($region_name == 44)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'New Zealand North',
));
}
if ($region_name == 45)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'New Zealand South',
));
}
if ($region_name == 46)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Bali',
));
}
if ($region_name == 47)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Java',
));
}
if ($region_name == 48)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Sumatra',
));
}
if ($region_name == 49)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Morocco',
));
}
if ($region_name == 50)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'West Africa',
));
}
if ($region_name == 51)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Madagascar',
));
}
if ($region_name == 52)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'South Africa',
));
}
if ($region_name == 53)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Cape Verde',
));
}
if ($region_name == 54)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Puerto Rico',
));
}
if ($region_name == 55)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'E. Caribbean',
));
}
if ($region_name == 56)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Japan South',
));
}
if ($region_name == 57)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Japan East',
));
}
if ($region_name == 58)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Philippines North',
));
}
if ($region_name == 59)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Philippines South',
));
}
if ($region_name == 60)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Maldives',
));
}
if ($region_name == 61)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Netherlands',
));
}
if ($region_name == 62)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Ireland/United Kingdom',
));
}
if ($region_name == 63)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'France / Spain',
));
}
if ($region_name == 64)
{
$template->assign_vars(array(
	'WWATCH_LOC'     => 'Portugal',
));
}

$template->assign_vars(array(
	'WWATCH_REGION'     => $region_name
));

 ?>
And here is the html block again ...

Code: Select all

<!--version $Id: links.html 236 2008-05-18 15:50:06Z kevin74 $ //-->
<div class="portal-panel">
	<div class="inner">
		<span class="portal-corners-top"><span></span></span>
			<h3>Surf Report</h3>
			<div><br />
			<!-- IF S_NO_WWATCH -->
			Set your WaveWatch surf report region in the control panel.
			<!-- ENDIF -->
			<!-- IF S_SET_WWATCH -->
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="180" height="153"><param name="movie" value="http://www.wavewatch.com/flash_tools/current_magnet.swf?theLocation={WWATCH_REGION}&city={WWATCH_LOC}" /><param name="quality" value="high" /><param name="wmode" value="transparent"><embed src="http://www.wavewatch.com/flash_tools/current_magnet.swf?theLocation={WWATCH_REGION}&city={WWATCH_LOC}" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="180" height="153"></embed></object>
			<!-- ENDIF -->
			</div>
			<br />
		<span class="portal-corners-bottom"><span></span></span>
	</div>
</div>
<br style="clear:both" />
And of course the include in the portal.php file ...

Code: Select all

include($phpbb_root_path . 'portal/block/wwatch.'.$phpEx);
I will clean up the "no region set" image including a small image of the WaveWatch logo.

Thanks again Kevin ... anywhere else and people seem insulted by my lack of coding knowledge. You have been very patient and responsive. Very cool.

[edit]

I noticed you used an "if empty" paramter instead of checking if the region =0. I will use your suggestion instead. I think it's cleaner.
Post Reply

Return to “Modifications Support”