Previous Thread
Next Thread
Print Thread
Hop To
Joined: Dec 2003
Posts: 6,562
Likes: 78
Joined: Dec 2003
Posts: 6,562
Likes: 78
Here I am again lost and confused upgrading from Classic to Threads. I was successful in turning on a custom island but I am confused to what I see in the control panel and what my options are to insert some code.

I open the Custom Islands 1 menu in the control panel for the first time and I see some code already there in the body section.
Quote
/* PHP CODE HERE, IF NECESSARY */

/* DO NOT CHANGE THE LINE BELOW */
$body = <<<EOF

{$user['LOGIN_NAME']}
{$user['DISPLAY_NAME']}
{$user['USER_ID']}


EOF;
/* DO NOT CHANGE THE LINE ABOVE */
So I insert some html just above the EOF; line and success.
I do not know what some of this existing stuff means other than I see the comment tags and some variable names($xxx) but it works and I move on.
I open Custom Islands 2 menu and I see in the body section
Quote
$time = time();

/* BODY HERE */
$body = <<<EOF

EOF;
Different from the first Island.
I open Island 3 thru 10 and I see
Quote
/* PHP CODE HERE */

/* BODY HERE */
$body = <<<EOF
EOF;
Different again.
I am going to make an assumption that the first and second island must have some extra code to present some type of example of how the island worked in prior versions and the 3rd Island code is what the minimum requirement is to create an island.If I wish to insert some HTML insert it between the <<<EOF and the EOF; tag. Not sure what you could place above the $body field?
1. If not could someone explain the difference and how to use this?
2. Could someone provide some basic code to provide some examples on how to use this feature.


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
I'll need to make sure all of these are consistent to avoid confusion. The 1st one was just an example as you noted. The 2nd and third are the same, just the empty space.

An example would be our Site Links in the upper left corner. This is a static content island, it's basically just HTML, and this is how we do it.

PHP Code

/* PHP CODE HERE */

/* BODY HERE */
$body = <<<EOF
<a href="https://www.ubbcentral.com">Home</a><br />
<a href="https://www.ubbcentral.com/features.php">Features</a><br />
<a href="https://www.ubbcentral.com/docs.php">Documentation</a><br />
<a href="https://www.ubbcentral.com/purchase.php">Pricing & Order</a><br />
<a href="http://www.infopop.com/members/members.php">Members Area</a>
EOF;
 

Basically, anything you want to show up in the island you'd put in between the $body = <<<EOF and EOF; lines.

Joined: Dec 2003
Posts: 6,562
Likes: 78
Joined: Dec 2003
Posts: 6,562
Likes: 78
Okay, that makes sense. In fact that is close to what I did. But what is the area below the PHP Code Here comment for? In the second island it had a $time field I turned it on bare bones and all i got was the caption to the island.
Do you have a simple example for that?


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
Joined: Jun 2006
Posts: 9,242
Likes: 1
Basically, that is where you'd put any php code that you may do in your island. To give a small example:

PHP Code

/* PHP CODE HERE */ 
$mymath = 2 + 2;

/* BODY HERE */ 
$body = <<<EOF
My 2 + 2 math equals $mymath
EOF;
 


So, what you'd see in the island is:

My 2 + 2 math equals 4

Joined: Dec 2003
Posts: 6,562
Likes: 78
Joined: Dec 2003
Posts: 6,562
Likes: 78
Thank you Rick.
Just what I needed to know.


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
you can do something like (just for example):

PHP Code

/* PHP CODE HERE */

$OiOi = "Hi there, it is: " . date( "D, d M Y H:i:s T", $time() );

/* BODY HERE */
$body = <<<EOF
$OiOi
</br>
Hey, isn't that the date time that i got from Php code
just above me?
EOF;
 

so you can do some php dancing with the body, prior to assigning it the raw html.

hope that helps a bit?

oops.. Rick beat me to it

Joined: Dec 2003
Posts: 6,562
Likes: 78
Joined: Dec 2003
Posts: 6,562
Likes: 78
One last question for confirmation.
The line of code that appears as
Quote
$body = <<<EOF
Has nothing to do with a html body tag but just the content of the island. Correct?


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Jun 2006
Posts: 16,299
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,299
Likes: 116
You must enter all content between:
<<<EOF
EOF;

It tells the webserver where your content starts and ends.


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Apr 2007
Posts: 3,940
Likes: 1
SD Offline
Former Developer
Former Developer
Joined: Apr 2007
Posts: 3,940
Likes: 1
the <<<EOF syntax is called HEREDOC string quoting..

Linky Dinky


you could just as easily have typed:

$body = <<<MUHAHA
buncha html here
MUHAHA;

and gotten the same result as using 'EOF' wink

think of 'MUHAHA' as some serious ass quotes laugh

2c

Joined: Jun 2006
Posts: 16,299
Likes: 116
UBB.threads Developer
UBB.threads Developer
Joined: Jun 2006
Posts: 16,299
Likes: 116
<snicker> EOF is kind of interesting, "end of file" you'd think he'd have used something like "ubb", you know:
<<<UBB
UBB;


I am a Web Development Contractor, I do not work for UBBCentral. I have provided free User to User Support since the beginning of these support forums.
Do you need Forum Install or Upgrade Services?
Forums: A Gardeners Forum, Scouters World
UBB.threads: UBBWiki, UBB Styles, UBB.Sitemaps
Longtime Supporter & Resident Post-A-Holic
VNC Web Services: Code Modifications, Upgrades, Styling, Coding Services, Disaster Recovery, and more!
Joined: Jan 2005
Posts: 6
F
stranger
stranger
F Offline
Joined: Jan 2005
Posts: 6
I have a question regarding output from loops. I have tried several ways to get my output to display properly within a content island but have yet had any success. Here is my code which outputs my data. When run independently it displays properly, but I can not get it to display in a content box.

Code
$data = mysql_query($query, $link);

while ($row = mysql_fetch_row($data))
	{
		echo "<h6>";
		foreach ($row as $field)
			{
				echo "$field<br>";
			}
		echo "</h6>";
	}
;

If I enter $field between the EOF in the content island, I only get the last field assigned. I have tried assigning the entire while statement, as well as the foreach to a variable but they both throw errors such as unexpected while or foreach. I know there has to be a way but I'm probably not seeing the trees for the forest. Any help is greatly appreciated. Thanks.

Joined: Jul 2006
Posts: 4,057
Joined: Jul 2006
Posts: 4,057
I have a portal set up to get some data from a database, just a random quote.

Anyway.
I have it showing the data i need, but it wont change
unless i edit the portal and hit submit.

Its stuck on one output.
Ive tried to up the cache from 0 to 1

----
Now if i put the same include file in the forum introduction
its changing every page refresh.

Is there away to get my sql query to behave similar to
it being in the forum introduction?
Or at least changing once a min.

Any idea's chaps.

is a simple sql to randomize a table and display that out put.


BOOM !! Version v7.6.1.1
People who inspire me Isaac ME Gizmo
Joined: Jul 2006
Posts: 4,057
Joined: Jul 2006
Posts: 4,057
okay its updating Not every refresh or 10 page refreshes
what could be the trigger, someone making a post?

Does it need a trigger?

It just not updating as i think it should be.
Updating meaning, output from the database.
I cant make out what makes it change when it does?


BOOM !! Version v7.6.1.1
People who inspire me Isaac ME Gizmo
Joined: Feb 2008
Posts: 9
T
stranger
stranger
T Offline
Joined: Feb 2008
Posts: 9
Need Help please. I tried doing the above to create a custom island on our forum and keep getting an error. What I am trying to do is create a custom box so that when people go directly to our forum they can click on it to get to another page on our site. I am having no luck at all. Our website is www.GETitLUBED.com it's an oil site but I want to create a box for people to click on the request a free catalog. Any help would be greatly appreciated.

Thanks, Tracey

Joined: Dec 2003
Posts: 6,562
Likes: 78
Joined: Dec 2003
Posts: 6,562
Likes: 78
Okay if you open a virgin custom island to edit it will look something like this:
Code
/* PHP CODE HERE */

/* BODY HERE */
$body = <<<EOF
EOF;
To add a link you place the html between the EOF tags.
so it would look like this:
Code
/* PHP CODE HERE */

/* BODY HERE */
$body = <<<EOF
<a href="http://www.getitlubed.com/freecatalog.html">Free Catalog</a>
EOF;
Of course you would edit the url to be where the catalog is.

Last edited by Ruben; 06/27/2009 3:37 PM. Reason: Changed example url to match for your free catalog on your home page

Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Dec 2003
Posts: 6,562
Likes: 78
Joined: Dec 2003
Posts: 6,562
Likes: 78
Another way you could do this is just place the html in the name of the island. and not touch the body content.
Code
<a href="http://www.getitlubed.com/freecatalog.html">Free Catalog</a>
Place that in the name and the island will just appear with the header name"Free Catalog" but you can click on it.


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Feb 2008
Posts: 9
T
stranger
stranger
T Offline
Joined: Feb 2008
Posts: 9
Thank you for the reply. I hve tried putting the info in both ways and keep getting this error:
Parse error: syntax error, unexpected T_START_HEREDOC in /data/10/0/84/90/736090/user/751517/htdocs/forums/cache_builders/custom/portal_box_2.php on line 6

Not sure what I am doing wrong. Any suggestions.

Thanks for your help
Tracey

Joined: Jan 2004
Posts: 2,474
Likes: 3
D
Pooh-Bah
Pooh-Bah
D Offline
Joined: Jan 2004
Posts: 2,474
Likes: 3
Can you post the code you are using, for us to take a look smile

Joined: Dec 2003
Posts: 6,562
Likes: 78
Joined: Dec 2003
Posts: 6,562
Likes: 78
Yea it looks like you inserted something where it should not from prior attempts and the tag called EOF(HEREDOC) is hosed.
So I would delete everything in the island and I mean delete everything and place everything below in the island:
Code
/* PHP CODE HERE */

/* BODY HERE */
$body = <<<EOF
<a href="http://www.getitlubed.com/freecatalog.html">Free Catalog</a>
EOF;

And don't forget to name the island.


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Feb 2008
Posts: 9
T
stranger
stranger
T Offline
Joined: Feb 2008
Posts: 9
Hello Ruben,
Thanks for the reply. I am still having no luck. Sorry to sound so stupid but I did what you had suggested and I am still getting that same error. Any other suggestions?
Thank you, Tracey

Joined: Dec 2003
Posts: 6,562
Likes: 78
Joined: Dec 2003
Posts: 6,562
Likes: 78
Then its time to do what Driv suggested.
Copy everything you have in the island. And post it here.


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Feb 2008
Posts: 9
T
stranger
stranger
T Offline
Joined: Feb 2008
Posts: 9
Hello, this is what I had posted in the island and I am still rec'ing this error.

Code
/* PHP CODE HERE, IF NECESSARY */

/* DO NOT CHANGE THE LINE BELOW */
$body  <<<EOF
<a href="http://www.getitlubed.com/freecatalog.html">Free Catalog</a>
EOF;
/* DO NOT CHANGE THE LINE ABOVE */

Parse error: syntax error, unexpected T_START_HEREDOC in /data/10/0/84/90/736090/user/751517/htdocs/forums/cache_builders/custom/portal_box_2.php on line 6.

Sorry for all the confusion, just not sure what I am doing wrong.

Thanks, Tracey

Last edited by Gizmo; 07/24/2009 8:48 PM. Reason: [code] tags
Joined: Dec 2003
Posts: 6,562
Likes: 78
Joined: Dec 2003
Posts: 6,562
Likes: 78
I see the problem.
You have omitted the = sign
Code
$body <<<EOF
Should be
Code
$body = <<<EOF


You can look at a custom island you have not edited yet or look at the several posts above.


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Feb 2008
Posts: 9
T
stranger
stranger
T Offline
Joined: Feb 2008
Posts: 9
Hey Ruben,
By now you must think I am an idiot. This is how I filled in the box.

Code
/* PHP CODE HERE */

/* BODY HERE */
$body = <<<EOF
<a href="http://www.getitlubed.com/freecatalog.html">Free Catalog</a>
EOF;

But I am still getting the error. I think I should give up.

Thanks for all your help. Tracey

Last edited by Gizmo; 07/24/2009 8:49 PM. Reason: [code] tags
Joined: Dec 2003
Posts: 6,562
Likes: 78
Joined: Dec 2003
Posts: 6,562
Likes: 78
Read your private message.


Blue Man Group
There is no such thing as stupid questions. Just stupid answers
Joined: Dec 2003
Posts: 6,562
Likes: 78
Joined: Dec 2003
Posts: 6,562
Likes: 78
Traylag figured it out and it is working now.


Blue Man Group
There is no such thing as stupid questions. Just stupid answers

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Bots
by Outdoorking - 04/13/2024 5:08 PM
Can you add html to language files?
by Baldeagle - 04/07/2024 2:41 PM
Do I need to rebuild my database?
by Baldeagle - 04/07/2024 2:58 AM
This is not a bug, but a suggestion
by Baldeagle - 04/05/2024 11:25 PM
Is UBB.threads still going?
by Aaron101 - 04/01/2022 8:18 AM
Who's Online Now
1 members (Nightcrawler), 552 guests, and 173 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)