|
Joined: Mar 2007
Posts: 307 Likes: 3
Enthusiast
|
Enthusiast
Joined: Mar 2007
Posts: 307 Likes: 3 |
If all other pages in my website are .htm/html what is the best way to use External Islands in one of them?
|
|
|
|
Joined: Dec 2003
Posts: 6,617 Likes: 84
|
Joined: Dec 2003
Posts: 6,617 Likes: 84 |
Bill, the built in tool is gone now that helped you get started . I do not know why it was removed. But anyway the island in question needs to have the always build option checked. Here are two methods to insert php into a html page. https://www.geeksforgeeks.org/how-t...cument-using-include-or-require-keyword/
Blue Man Group There is no such thing as stupid questions. Just stupid answers
|
|
|
|
Joined: Mar 2007
Posts: 307 Likes: 3
Enthusiast
|
Enthusiast
Joined: Mar 2007
Posts: 307 Likes: 3 |
Thanks Ruben,
I was looking at the different ways to get the script to execute from within an HTML page. I see I can add a line to my .htaccess to get all html pages to get processed as php, but didn't know if there were any downsides to that. Specifically, with my index.html page I didn't want to redirect to an index.php (or change the name) and have unentended Google consequences.
After some deliberation my plan is to leave index.html in place and make a new index.php which my server seems to treat as default.
What was the Tool you were referring to? Something to create the External Island codes? I'd really be interested in that. I've been searching here for direction on how to create one for a Random Gallery Image, but so far no luck.
|
|
|
|
Joined: Dec 2003
Posts: 6,617 Likes: 84
|
Joined: Dec 2003
Posts: 6,617 Likes: 84 |
as i recall when you selected always build then a link would take you to a page with the coding just for external islands as well as some brief notes on how to but you still had to work on the css tags because the style sheet was not declared. now you need to grab the file in cache builders and kinda marry that with the template file. the file for the option is still there and works
Okay stupid me because I have not used it in years. In cp goto column layout where you set the order of display for islands at the far right column it is there now. But do not forget to check the always build on the subject island,
Blue Man Group There is no such thing as stupid questions. Just stupid answers
|
|
|
|
Joined: Mar 2007
Posts: 307 Likes: 3
Enthusiast
|
Enthusiast
Joined: Mar 2007
Posts: 307 Likes: 3 |
Okay stupid me because I have not used it in years. In cp goto column layout where you set the order of display for islands at the far right column it is there now. But do not forget to check the always build on the subject island, I was about to post that. I'm able to get the Islands to work externally, just working on formatting issues now. Seems I do have a code for a Random Gallery Island (that I must've gotten here somewhere?) but the thumbnail is only 120px wide.
|
|
|
|
Joined: Mar 2007
Posts: 307 Likes: 3
Enthusiast
|
Enthusiast
Joined: Mar 2007
Posts: 307 Likes: 3 |
I found the thread where I got the Random Code from: https://www.ubbcentral.com/forums/ubbthreads.php/topics/260118/random-image-islandI updated mine to the last code modification there (Thanks isaac !!) and it works with a larger pic. Can a code like that be modified to pick and Display a Random Thread within a specific Forum?
|
|
|
|
Joined: Mar 2007
Posts: 307 Likes: 3
Enthusiast
|
Enthusiast
Joined: Mar 2007
Posts: 307 Likes: 3 |
Is there any downside to adding a line to .htaccess so that htm/html pages will be processed as php so that I can include External Islands on them?
|
|
|
|
Joined: Dec 2003
Posts: 6,617 Likes: 84
|
Joined: Dec 2003
Posts: 6,617 Likes: 84 |
You can imbed php in html Just use the start and end tags
Blue Man Group There is no such thing as stupid questions. Just stupid answers
|
|
|
|
Joined: Mar 2007
Posts: 307 Likes: 3
Enthusiast
|
Enthusiast
Joined: Mar 2007
Posts: 307 Likes: 3 |
Ruben, It doesn't seem to work with just the tags. Do I have to add a line to my .htaccess file? Like this? Or similar? AddType application/x-httpd-php .html .htm
|
|
|
|
Joined: Jun 2006
Posts: 16,347 Likes: 122
|
Joined: Jun 2006
Posts: 16,347 Likes: 122 |
That is entirely unsupported code, you may discover issues with scripts in the future. PHP tags are supported in Custom Islands, syntax would be similar to (this is the Random Gallery image code): /* YOUR PHP CODE GOES IN THIS TOP SECTION */
$query = "
SELECT POST_ID, FILE_DIR, FILE_NAME
FROM {$config['TABLE_PREFIX']}FILES
WHERE (FILE_DIR <> '' AND FILE_DIR IS NOT NULL)
AND (FILE_TYPE = 'jpg'
OR FILE_TYPE = 'gif'
OR FILE_TYPE = 'jpg'
OR FILE_TYPE = 'jpeg'
OR FILE_TYPE = 'png')
ORDER BY rand()
LIMIT 1
";
$sth = $dbh->do_query($query, __LINE__, __FILE__);
list($postId, $fDir, $fName) = $dbh->fetch_array($sth);
/* YOUR HTML GOES BETWEEN THE EOF HEREDOC BELOW */
$body = <<<EOF
<div class="acvt">
<div style="height:{$config['MAX_THUMB_W_H']}px;overflow:hidden;position:relative;width:100%;display:inline-block;">
<a href="{$config['BASE_URL']}/ubbthreads.php?ubb=showgallery&Number=$postId"><img src="{$config['BASE_URL']}/gallery/$fDir/medium/$fName" alt="" title="" class="p2 cp oi" style="position:absolute;left:-100%;right:-100%;top:-100%;bottom:-100%;margin:auto;max-width:280px;min-height:100%;"></a>
</div>
</div>
EOF;
|
|
|
|
Joined: Mar 2007
Posts: 307 Likes: 3
Enthusiast
|
Enthusiast
Joined: Mar 2007
Posts: 307 Likes: 3 |
You lost me somewhere... If I put the following into a .php page it works. If I put it into a htm page it doesn't <?php
if (!defined('UBB_MAIN_PROGRAM')) define('UBB_MAIN_PROGRAM',1);
$style_side="";$tbopen="";$tbclose="";
echo "<table width=\"100%\">";
include("/home/electrm4/public_html/forums/languages/english/portal_islands.php");
include("/home/electrm4/public_html/forums/languages/english/generic.php");
include("/home/electrm4/public_html/forums/cache/portal_box_8.php");
echo "</table>";
?> .htm page.php pageHow can I make the External Islands work on existing .htm/html pages without renaming them?
|
|
|
|
Joined: Jun 2006
Posts: 16,347 Likes: 122
|
Joined: Jun 2006
Posts: 16,347 Likes: 122 |
That code is for a Custom Island in the Control Panel; if you look at the Column Layout page it has links to syntax for External Use for PHP applications, but your mileage may vary.
|
|
|
|
Joined: Mar 2007
Posts: 307 Likes: 3
Enthusiast
|
Enthusiast
Joined: Mar 2007
Posts: 307 Likes: 3 |
I got the code from the External link on the Column Layout page. It says This page will show you what you'll need to put into a page outside of UBB.threads to use this Content Island inside of it. The page will need to be PHP enabled. What does "PHP enabled" mean? Does it have to be a .php page? Or, can it be used in a htm/html page with some "enabling"?
Last edited by ECNet; 08/25/2024 9:20 AM.
|
|
|
|
Joined: Dec 2003
Posts: 6,617 Likes: 84
|
Joined: Dec 2003
Posts: 6,617 Likes: 84 |
Most hosts today allow pho tags in html pages .
As I said before just insert the php tags in your html file Meaning insert the php start and end tags in the html file With the pho code in between No need to have just a pho file to run the script The server will run both php and html code in the same file at the same time if notated correctly
Blue Man Group There is no such thing as stupid questions. Just stupid answers
|
|
|
|
Joined: Mar 2007
Posts: 307 Likes: 3
Enthusiast
|
Enthusiast
Joined: Mar 2007
Posts: 307 Likes: 3 |
Ruben,
Did you look at my examples above? Did I do something wrong in the .htm example or should I look to the host setup?
|
|
|
|
Joined: Mar 2007
Posts: 307 Likes: 3
Enthusiast
|
Enthusiast
Joined: Mar 2007
Posts: 307 Likes: 3 |
Thanks,
I did see that. I'm trying to see what works.
|
|
|
|
Joined: Mar 2007
Posts: 307 Likes: 3
Enthusiast
|
Enthusiast
Joined: Mar 2007
Posts: 307 Likes: 3 |
Got it. I was getting server error because I had some duplicate lines.
Thx for checking me.
|
|
|
4 members (Baldeagle, toner, Mender, 1 invisible),
315
guests, and
116
robots. |
Key:
Admin,
Global Mod,
Mod
|
|
|
|