TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,230
  • Total Topics: 21,353
  • Online today: 446
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 186
  • Total: 187
  • @rjen

Page (code) is shown inside an article but not inside a block.

Started by ianus, April 15, 2009, 05:27:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ianus

Greetings!

Basics:
I use SMF 1.1.4 and TP 0.9.8
(Please donââ,¬â,,¢t blame me because of the Version Numbers.)

I like to run a nice little script to show a spinning wheel on my frontpage.

The source of the script:
http://www.mibhouse.org/pokemon_jojo/public/js/pbb-magicwheel/pbb-magicwheel.html

For my personal use, I have deleted the info and settings box and use only the wheel part.

My version of the wheel:
http://www.firopolis.de/forum/wheel/wheel.php
and / or
http://www.firopolis.de/forum/wheel/wheel.html

Quest:
I want to show this (php) file on my frontpage ââ,¬â€œ inside a php-block.

Step One:
I choose a php-block and try to include it.
include ('http://www.firopolis.de/forum/wheel/wheel.php');

Well noting happens. I get the block but no content.
After that I have added some plain text to verify that the include is working.
Now I get my text but nothing more.

Step Two:
I have deleted the php and echo stuff and put the code into an html-block.
(Because of that I have also a wheel.html)
Same result, nothing is shown.

Step Three:
I have created an html article and put all the stuff of the html file into this article.
Wonder what happens?
The wheel is shown on my frontpage, but it donââ,¬â,,¢t keep any borders.

I have added a temporary ââ,¬Å"Plain Testboxââ,¬Â to make the problem more obvious.

My frontpage:
http://www.firopolis.de/forum/index.php

Question is:
How to include the wheel.php into a php block.
The wheel should stay inside the block and the whole block should move down when someone is using the above navigation.
(Try to klick on Letzte Beiträge (+/-) get the idea.)

Any help is appreciated.


G6Cad

When you paste the code, click the <> sign on the editor, paste the code and save and check, if it still looks the same, edit the article again and click the <> again, place the curser infornt of the code and click the backtab so it moves up to the top of the editorframe, save again and check the article.

ianus

First, thanks for your kind reply.

Second.
Iââ,¬â,,¢m sorry, but I have no idea of what you tell me.

What do you mean with the <> sign?
Switch to Source code?

Well anyway. I donââ,¬â,,¢t want to have the code inside an article.

My code is working as ââ,¬Å"stand aloneââ,¬Â and I would like to include this into a php-block.

I have done this with navigation files before.
At the moment the Letzte Beiträge (+/-) part is an external file
(Source: http://www.firopolis.de/forum/PortalStartseite.php (missing SMF functions because TP take care of that))
I also use a left navigation for some boards and all of them are external.
(Example: Left Navigation: http://www.firopolis.de/forum/index.php/board,45.0.html)

(External means, not written with the TP editor but on my webspace of course.)

So, an article is only my second choice, because I am more flexible with positioning of blocks.

JPDeni

Is there a reason that you can't just paste the php code into a php article and dispense with the "include" altogether?

ianus

:'( yes

I don't know how to format the php file. I have no clue where to put an echo or close it.

Especially when the file calls some <script type=" ââ,¬Â¦
and if some script or css is inside the file, I have no chance to format the file in a way that a php-block donââ,¬â,,¢t send out error messages.

Itââ,¬â,,¢s a shame, I know.

I used to try it this time (again) but after I put the code of the html-file into a html-block (with no positiv result) I quit to find out where to warp echos around the code.

JPDeni

Can you give us either the php code or the html code so we can help you figure it out? Please put the code into code tags -- use the # key in the reply form -- and we might be able to work it out together.

ianus

Of course I can give the code.

The working examples:

http://www.firopolis.de/forum/wheel/wheel.php
and / or
http://www.firopolis.de/forum/wheel/wheel.html

Code of the PHP Version:
<head>


<link rel="stylesheet" type="text/css" href="http://www.firopolis.de/forum/wheel/styles.css" />
<script type="text/javascript"  src="http://www.firopolis.de/forum/wheel/mootools-1.2.1-core-yc.js" ></script>
<script type="text/javascript"  src="http://www.firopolis.de/forum/wheel/mootools-1.2-more.js" ></script>
<script type="text/javascript"  src="http://www.firopolis.de/forum/wheel/pbb-magicwheel-1.0.js" ></script>
<style type="text/css"><!--

/*
Magic Wheel CSS
*/
.loading {
background: url('wheel-loader.gif') center center no-repeat;
}

#magicwheel {
position: absolute;
}

.tip {
position: absolute;
visibility: hidden;
top: 0;
left: 0;
background: url('arrow.png') bottom center no-repeat;
z-index: 1000;
padding-bottom: 6px;
}

.tip span {
padding: 1px 10px;
background: black;
color: #fff;
font-weight: bold;
}

#magicwheel .icon, #magicwheel .ref {
position: absolute;
border: none;
visibility: hidden;
}

/*
Settings CSS
*/
.box {
position: absolute;
color: #666;
margin: 10px;
padding: 0px 7px 5px 7px;
background: #f1f1f1;
width: 280px;
z-index: 1000;
}

.slider {
background: #D8D8D8;
height: 10px;
margin-bottom: 7px;
cursor: pointer;
}

.knob {
background: #666;
width: 20px;
height: 10px;
cursor: pointer;
}
--></style>

<script type="text/javascript" >
window.addEvent('domready', function(){
var MyMW = new PBB_MagicWheel($('magicwheel'));

var SLIDEuserIconWidth = new Slider($('SLIDEuserIconWidth'), $('KNOBuserIconWidth'), {
range: [MyMW.options.iconMinWidth, MyMW.options.iconMaxWidth],
steps: MyMW.options.iconMaxWidth,
wheel: true,
onChange: function(pos){
MyMW.options.userIconWidth = pos;
MyMW.checkSettings();
}
}).set(MyMW.options.userIconWidth);

var SLIDEuserIconMinWidth = new Slider($('SLIDEuserIconMinWidth'), $('KNOBuserIconMinWidth'), {
range: [MyMW.options.iconMinWidth, MyMW.options.iconMaxWidth],
steps: MyMW.options.iconMaxWidth,
wheel: true,
onChange: function(pos){
if(pos > MyMW.options.userIconWidth)
this.set(MyMW.options.userIconWidth);
else
MyMW.options.userIconMinWidth = pos;
MyMW.checkSettings();
}
}).set(MyMW.options.userIconMinWidth);

var SLIDEuserWidth = new Slider($('SLIDEuserWidth'), $('KNOBuserWidth'), {
range: [MyMW.options.minWidth, MyMW.options.maxWidth],
steps: 100,
wheel: true,
onChange: function(pos){
if(pos > MyMW.options.maxWidth - MyMW.options.userIconWidth)
this.set(MyMW.options.maxWidth - MyMW.options.userIconWidth);
else
MyMW.options.userWidth = pos;
MyMW.checkSettings();
}
}).set(MyMW.options.userWidth);

var SLIDEuserHeight = new Slider($('SLIDEuserHeight'), $('KNOBuserHeight'), {
range: [MyMW.options.minHeight, MyMW.options.maxHeight],
steps: 100,
wheel: true,
onChange: function(pos){
MyMW.options.userHeight = pos / MyMW.icons.length;
MyMW.checkSettings();
}
}).set(MyMW.options.userHeight * MyMW.icons.length);

var SLIDEuserSpeed = new Slider($('SLIDEuserSpeed'), $('KNOBuserSpeed'), {
range: [-1000, 1000],
steps: 200,
wheel: true,
onChange: function(pos){
MyMW.options.userSpeed = pos / 1000;
MyMW.checkSettings();
}
}).set(MyMW.options.userSpeed * 1000);

var SLIDEuserIconOpacity = new Slider($('SLIDEuserIconOpacity'), $('KNOBuserIconOpacity'), {
range: [0, 10],
steps: 10,
wheel: true,
onChange: function(pos){
MyMW.options.userIconOpacity = pos / 10;
MyMW.checkSettings();
}
}).set(MyMW.options.userIconOpacity * 10);

var SLIDEuserIconMinOpacity = new Slider($('SLIDEuserIconMinOpacity'), $('KNOBuserIconMinOpacity'), {
range: [0, 10],
steps: 10,
wheel: true,
onChange: function(pos){
if(pos / 10 > MyMW.options.userIconOpacity)
this.set(MyMW.options.userIconOpacity * 10);
else
MyMW.options.userIconMinOpacity = pos / 10;
MyMW.checkSettings();
}
}).set(MyMW.options.userIconMinOpacity * 10);

var SLIDEuserRefOpacity = new Slider($('SLIDEuserRefOpacity'), $('KNOBuserRefOpacity'), {
range: [0, 10],
steps: 10,
wheel: true,
onChange: function(pos){
MyMW.options.userRefOpacity = pos / 10;
MyMW.checkSettings();
}
}).set(MyMW.options.userRefOpacity * 10);

$('add').addEvent('click', function(e){
e.stop();
MyMW.addIcon('icons/new.png', 'icons/new.png', 'Hey i\' the new icon !');
});
});
</script>


</head>
<body>
<?php
echo'
<div id="magicwheel" class="loading">
<a href="http://www.firopolis.de/forum/index.php/board,45.0.html" title="Risen"><img class="icon" src="http://www.firopolis.de/forum/Themes/default/images/post/Oblivion-48x48.png" /></a>
<a href="http://www.firopolis.de/forum/index.php/board,78.0.html" title="Risen"><img class="icon" src="http://www.firopolis.de/forum/Themes/default/images/post/mic_risen.gif" /></a>
<a href="http://www.firopolis.de/forum/index.php/board,85.0.html" title="Fallout"><img class="icon" src="http://www.firopolis.de/forum/Themes/Polis_main/images/post/mic_fallout.gif" /></a>
<a href="http://www.firopolis.de/forum/index.php/board,91.0.html" title="Dragon Age"><img class="icon" src="http://www.firopolis.de/forum/Themes/default/images/post/mic_dragonage.gif" /></a>
<a href="http://www.firopolis.de/forum/index.php/board,40.0.html" title="Gothic 3"><img class="icon" src="http://www.firopolis.de/forum/Themes/default/images/post/mic_g3.gif" /></a>
<a href="http://www.firopolis.de/forum/index.php/board,82.0.html" title="Sacred 2"><img class="icon" src="http://www.firopolis.de/forum/Themes/default/images/post/mic_sacred2.gif" /></a>
<a href="http://www.firopolis.de/forum/index.php/board,65.0.html" title="The Witcher"><img class="icon" src="http://www.firopolis.de/forum/Themes/default/images/post/mic_twitch.gif" /></a>

</div>
'
;
?>
</body>

JPDeni

There's no actual php code in there. Just one "echo" statement. You would do better to just use the html:


<link rel="stylesheet" type="text/css" href="http://www.firopolis.de/forum/wheel/styles.css" />
<script type="text/javascript"  src="http://www.firopolis.de/forum/wheel/mootools-1.2.1-core-yc.js" ></script>
<script type="text/javascript"  src="http://www.firopolis.de/forum/wheel/mootools-1.2-more.js" ></script>
<script type="text/javascript"  src="http://www.firopolis.de/forum/wheel/pbb-magicwheel-1.0.js" ></script>
<style type="text/css"><!--

/*
Magic Wheel CSS
*/
.loading {
background: url('wheel-loader.gif') center center no-repeat;
}

#magicwheel {
position: absolute;
}

.tip {
position: absolute;
visibility: hidden;
top: 0;
left: 0;
background: url('arrow.png') bottom center no-repeat;
z-index: 1000;
padding-bottom: 6px;
}

.tip span {
padding: 1px 10px;
background: black;
color: #fff;
font-weight: bold;
}

#magicwheel .icon, #magicwheel .ref {
position: absolute;
border: none;
visibility: hidden;
}

/*
Settings CSS
*/
.box {
position: absolute;
color: #666;
margin: 10px;
padding: 0px 7px 5px 7px;
background: #f1f1f1;
width: 280px;
z-index: 1000;
}

.slider {
background: #D8D8D8;
height: 10px;
margin-bottom: 7px;
cursor: pointer;
}

.knob {
background: #666;
width: 20px;
height: 10px;
cursor: pointer;
}
--></style>

<script type="text/javascript" >
window.addEvent('domready', function(){
var MyMW = new PBB_MagicWheel($('magicwheel'));

var SLIDEuserIconWidth = new Slider($('SLIDEuserIconWidth'), $('KNOBuserIconWidth'), {
range: [MyMW.options.iconMinWidth, MyMW.options.iconMaxWidth],
steps: MyMW.options.iconMaxWidth,
wheel: true,
onChange: function(pos){
MyMW.options.userIconWidth = pos;
MyMW.checkSettings();
}
}).set(MyMW.options.userIconWidth);

var SLIDEuserIconMinWidth = new Slider($('SLIDEuserIconMinWidth'), $('KNOBuserIconMinWidth'), {
range: [MyMW.options.iconMinWidth, MyMW.options.iconMaxWidth],
steps: MyMW.options.iconMaxWidth,
wheel: true,
onChange: function(pos){
if(pos > MyMW.options.userIconWidth)
this.set(MyMW.options.userIconWidth);
else
MyMW.options.userIconMinWidth = pos;
MyMW.checkSettings();
}
}).set(MyMW.options.userIconMinWidth);

var SLIDEuserWidth = new Slider($('SLIDEuserWidth'), $('KNOBuserWidth'), {
range: [MyMW.options.minWidth, MyMW.options.maxWidth],
steps: 100,
wheel: true,
onChange: function(pos){
if(pos > MyMW.options.maxWidth - MyMW.options.userIconWidth)
this.set(MyMW.options.maxWidth - MyMW.options.userIconWidth);
else
MyMW.options.userWidth = pos;
MyMW.checkSettings();
}
}).set(MyMW.options.userWidth);

var SLIDEuserHeight = new Slider($('SLIDEuserHeight'), $('KNOBuserHeight'), {
range: [MyMW.options.minHeight, MyMW.options.maxHeight],
steps: 100,
wheel: true,
onChange: function(pos){
MyMW.options.userHeight = pos / MyMW.icons.length;
MyMW.checkSettings();
}
}).set(MyMW.options.userHeight * MyMW.icons.length);

var SLIDEuserSpeed = new Slider($('SLIDEuserSpeed'), $('KNOBuserSpeed'), {
range: [-1000, 1000],
steps: 200,
wheel: true,
onChange: function(pos){
MyMW.options.userSpeed = pos / 1000;
MyMW.checkSettings();
}
}).set(MyMW.options.userSpeed * 1000);

var SLIDEuserIconOpacity = new Slider($('SLIDEuserIconOpacity'), $('KNOBuserIconOpacity'), {
range: [0, 10],
steps: 10,
wheel: true,
onChange: function(pos){
MyMW.options.userIconOpacity = pos / 10;
MyMW.checkSettings();
}
}).set(MyMW.options.userIconOpacity * 10);

var SLIDEuserIconMinOpacity = new Slider($('SLIDEuserIconMinOpacity'), $('KNOBuserIconMinOpacity'), {
range: [0, 10],
steps: 10,
wheel: true,
onChange: function(pos){
if(pos / 10 > MyMW.options.userIconOpacity)
this.set(MyMW.options.userIconOpacity * 10);
else
MyMW.options.userIconMinOpacity = pos / 10;
MyMW.checkSettings();
}
}).set(MyMW.options.userIconMinOpacity * 10);

var SLIDEuserRefOpacity = new Slider($('SLIDEuserRefOpacity'), $('KNOBuserRefOpacity'), {
range: [0, 10],
steps: 10,
wheel: true,
onChange: function(pos){
MyMW.options.userRefOpacity = pos / 10;
MyMW.checkSettings();
}
}).set(MyMW.options.userRefOpacity * 10);

$('add').addEvent('click', function(e){
e.stop();
MyMW.addIcon('icons/new.png', 'icons/new.png', 'Hey i\' the new icon !');
});
});
</script>

<div id="magicwheel" class="loading">
<a href="http://www.firopolis.de/forum/index.php/board,45.0.html" title="Risen"><img class="icon" src="http://www.firopolis.de/forum/Themes/default/images/post/Oblivion-48x48.png" /></a>
<a href="http://www.firopolis.de/forum/index.php/board,78.0.html" title="Risen"><img class="icon" src="http://www.firopolis.de/forum/Themes/default/images/post/mic_risen.gif" /></a>
<a href="http://www.firopolis.de/forum/index.php/board,85.0.html" title="Fallout"><img class="icon" src="http://www.firopolis.de/forum/Themes/Polis_main/images/post/mic_fallout.gif" /></a>
<a href="http://www.firopolis.de/forum/index.php/board,91.0.html" title="Dragon Age"><img class="icon" src="http://www.firopolis.de/forum/Themes/default/images/post/mic_dragonage.gif" /></a>
<a href="http://www.firopolis.de/forum/index.php/board,40.0.html" title="Gothic 3"><img class="icon" src="http://www.firopolis.de/forum/Themes/default/images/post/mic_g3.gif" /></a>
<a href="http://www.firopolis.de/forum/index.php/board,82.0.html" title="Sacred 2"><img class="icon" src="http://www.firopolis.de/forum/Themes/default/images/post/mic_sacred2.gif" /></a>
<a href="http://www.firopolis.de/forum/index.php/board,65.0.html" title="The Witcher"><img class="icon" src="http://www.firopolis.de/forum/Themes/default/images/post/mic_twitch.gif" /></a>

</div>


Paste that into the source code (not directly into the editor) in an html article and give that a shot. The only thing that might be a problem is the relative paths and URLs to your images. One suggestion is to use full URLs. The other is to rewrite your URLs relative to the Sources directory. It's one of those things that I always have to play around with.

ianus

Thanks a lot for your time. Itââ,¬â,,¢s really appreciated.

Mh, I think, I have to clarify some things.

I run this ââ,¬â€œ the html code ââ,¬â€œ already in an html article.
Frontpage: http://www.firopolis.de/forum/index.php

Now I like to avoid articles and use a block instead.
(Because of positioning in the most cases, in this case additionally because of the ââ,¬Å"overlappingââ,¬Â)
If I put the same code into a block, it will show only the pictures.

Because of that, I used the full URLs. As far as I know, this is the most fail-safe way.
Tomorrow I will try to used relative path instead. (Canââ,¬â,,¢t connect to my server at the moment. My computer is recording a TV stream right know and canââ,¬â,,¢t handle web-traffic at the same time.)

In general, I like to avoid the html editor and for that reason I prefer to include a file (from my server) into an php-block ââ,¬â€œ even if the file itself isnââ,¬â,,¢t a ââ,¬Å"realââ,¬Â php file.

The editor is nice to write and format some text, but I need the syntax highlight of the notepad++.

Mainly, I donââ,¬â,,¢t understand why the ââ,¬Å"stand aloneââ,¬Â and the ââ,¬Å"articleââ,¬Â version are working, but not if I include the file. Especially because this file http://www.firopolis.de/forum/PortalStartseite.php , as an example, is of the ââ,¬Å"nearlyââ,¬Â same style. An external php file with a full URL link to a css and script file, with some script inside and included into a php-block.

Anyway, I will report back tomorrow.
Thanks again for your time.

JPDeni

QuoteIf I put the same code into a block, it will show only the pictures

I don't know what that means. I see links along with the pictures. What do you need that is different?

QuoteIn general, I like to avoid the html editor and for that reason I prefer to include a file (from my server) into an php-block ââ,¬â€œ even if the file itself isnââ,¬â,,¢t a ââ,¬Å"realââ,¬Â php file.

That might be the way to go when you're working with a stand-alone file, but you're making a whole lot more trouble than you need to if you do this with TP. You can turn off the html editor -- you can completely delete the folder where the editor is stored -- if you like.

QuoteMainly, I donââ,¬â,,¢t understand why the ââ,¬Å"stand aloneââ,¬Â and the ââ,¬Å"articleââ,¬Â version are working, but not if I include the file.
I don't either. But then I don't know what the actual problem is.

Is it that the block doesn't completely contain the images? You can easily use css to create a div of the proper height and put the images in that.

This website is proudly hosted on Crocweb Cloud Website Hosting.