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,971
  • Latest: camgear
Stats
  • Total Posts: 196,068
  • Total Topics: 21,339
  • Online today: 134
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 107
  • Total: 108
  • @rjen

Issues with a css inside a block ...

Started by mrbean17, March 27, 2007, 11:11:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JPDeni

What is line one of your code? It must be starting with a < which won't work in a php box.

If your first line is


<php


delete that line. It will make the php box not work

If your first line is something like


<html>


you have to put it into an echo statement


echo '<html>';


If it's neither of these, then post what your first line is and I'll try to help.

Resident Geek

Here is a snippet of the code that I'm using:

<?php
//Lets start by making a simple header and loading the css ?>
<LINK REL="stylesheet" TYPE="text/css" HREF="http://www.importantworkstuff.com/HTML/Includes/mainmenucss.css">
<div class="smalltext">
<div id="iwsmainmenu">
<ul id="navlist">
<font size="2"><b>Important Work Stuff</b></font>
<hr>
<font size="1">
<?php
// find out the domain
$domain = $_SERVER['HTTP_HOST'];
// find out the path to the current file:
$path = $_SERVER['SCRIPT_NAME'];
// find out the QueryString:
$queryString = $_SERVER['QUERY_STRING'];
// put it all together:
$url = "http://" . $domain . $path . "?" . $queryString;



Again, it runs fine in a seperate php file, but not in the phpbox.
This part is repeated, slightly altered for each link.

//Are we on the index page now?
if ($url == 'http://www.importantworkstuff.com/forum/index.php')
{
//If so then display the link as the "current" id ?>
<html><li id="current"><img src="http://www.importantworkstuff.com/Images/ForumMenu/home.gif"/>&nbsp;<a href="http://www.importantworkstuff.com/forum/index.php"><b>Home</b></a></li></html><?php
}
else
{

//If not then display the link as the default id ?>
<html><li><img src="http://www.importantworkstuff.com/Images/ForumMenu/home.gif"/>&nbsp;<a href="http://www.importantworkstuff.com/forum/index.php">Home</a></li></html> <?php
}
?>

Resident Geek

OK, so it's starting with '<'
So what should I put into it?
Am I not allowed to put any "<?php" or "?>" in the box?

JPDeni

QuoteAm I not allowed to put any "<?php" or "?>" in the box?

Correct. Delete those lines. The reason is that the code in php boxes is run through an "eval" statement, rather than being a stand-alone php script. Those statements cannot have the opening and closing php tags.

Resident Geek

OK, so the phpbox instantly assumes that everything put into it is php. If I put HTML in, I have to put it inside of an echo statement to tell it that it's not php and to run it like normal text, which (coincidentally) reads as HTML.
Got it!
It's working now.

Here is your menu mrbean. And I didn't even have to use javascript. I realized it could be done with php instead.

//Lets start by making a simple header and loading the css
echo '<LINK REL="stylesheet" TYPE="text/css" HREF="http://www.importantworkstuff.com/HTML/Includes/mainmenucss.css">
<div class="smalltext">
<div id="iwsmainmenu">
<ul id="navlist">
<font size="2"><b>Important Work Stuff</b></font>
<hr>
<font size="1">';

// find out the domain
$domain = $_SERVER['HTTP_HOST'];
// find out the path to the current file:
$path = $_SERVER['SCRIPT_NAME'];
// find out the QueryString:
$queryString = $_SERVER['QUERY_STRING'];
// put it all together:
$url = "http://" . $domain . $path . "?" . $queryString;

//Are we on the index page now?
if ($url == 'http://www.importantworkstuff.com/forum/index.php?')
{
//If so then display the link as the "current" id
echo '<html><li id="current"><img src="http://www.importantworkstuff.com/Images/ForumMenu/home.gif"/>&nbsp;<a href="http://www.importantworkstuff.com/forum/index.php?"><b>Home</b></a></li></html>';
}
else
{

//If not then display the link as the default id
echo '<html><li><img src="http://www.importantworkstuff.com/Images/ForumMenu/home.gif"/>&nbsp;<a href="http://www.priacta.com/forum/index.php">Home</a></li></html>';
}

//Are we on the arcade page now?
if ($url == 'http://www.importantworkstuff.com/forum/index.php?action=arcade')
{
//If so then display the link as the "current" id
echo '<html><li id="current"><img src="http://www.importantworkstuff.com/Images/ForumMenu/arcade.gif"/>&nbsp;<a href="http://www.importantworkstuff.com/Forum/index.php?action=arcade"><b>Arcade</b></a></li></li></html>';
}
else
{

//If not then display the link as the default id
echo '<html><li><img src="http://www.importantworkstuff.com/Images/ForumMenu/arcade.gif"/>&nbsp;<a href="http://www.importantworkstuff.com/Forum/index.php?action=arcade">Arcade</a></li></html>';
}

//Are we on the chat page now?
if ($url == 'http://www.importantworkstuff.com/forum/index.php?action=chat')
{
//If so then display the link as the "current" id
echo '<html><li id="current"><img src="http://www.importantworkstuff.com/Images/ForumMenu/online.gif"/>&nbsp;<a href="http://www.importantworkstuff.com/Forum/index.php?action=chat"><b>Chat</b></a></html>';
}
else
{

//If not then display the link as the default id
echo '<html><li><img src="http://www.importantworkstuff.com/Images/ForumMenu/online.gif"/>&nbsp;<a href="http://www.importantworkstuff.com/Forum/index.php?action=chat">Chat</a></html>';
}

//Are we on the download page now?
if ($url == 'http://www.importantworkstuff.com/forum/index.php?action=gallery')
{
//If so then display the link as the "current" id
echo '<html><li id="current"><img src="http://www.importantworkstuff.com/Images/ForumMenu/gallery.gif"/>&nbsp;<a href="http://www.importantworkstuff.com/Forum/index.php?action=gallery"><b>Gallery</b></a></html>';
}
else
{

//If not then display the link as the default id
echo '<html><li><img src="http://www.importantworkstuff.com/Images/ForumMenu/gallery.gif"/>&nbsp;<a href="http://www.importantworkstuff.com/Forum/index.php?action=gallery">Gallery</a></html>';
}

//Are we on the forum page now?
if ($url == 'http://www.importantworkstuff.com/forum/index.php?action=forum')
{
//If so then display the link as the "current" id
echo '<html><li id="current"><img src="http://www.importantworkstuff.com/Images/ForumMenu/forum.gif" />&nbsp;<a href="http://www.importantworkstuff.com/Forum/index.php?action=forum"><b>Forum</b></a></font></html>
<br>
<font size="2"><b>Links</b></font>
<hr>
<font size="1">';
}
else
{

//If not then display the link as the default id
echo '<html><li><img src="http://www.importantworkstuff.com/Images/ForumMenu/forum.gif" />&nbsp;<a href="http://www.importantworkstuff.com/Forum/index.php?action=forum">Forum</a></font></html></font>
<br>
<font size="2"><b>Links</b></font>
<hr>
<font size="1">';
}

echo'
<li><img src="http://www.importantworkstuff.com/Images/ForumMenu/links.gif"/>&nbsp;<a href="http://www.adultswim.com/" TARGET="_blank">Adult Swim</a></li>
<li><img src="http://www.importantworkstuff.com/Images/ForumMenu/links.gif"/>&nbsp;<a href="http://images.google.com/" TARGET="_blank">Google Images</a></li>
<li><img src="http://www.importantworkstuff.com/Images/ForumMenu/links.gif"/>&nbsp;<a href="http://www.wikipedia.org/" TARGET="_blank">Wikipedia</a></li>
<li><img src="http://www.importantworkstuff.com/Images/ForumMenu/links.gif"/>&nbsp;<a href="http://sports.yahoo.com/" TARGET="_blank">Yahoo Sports</a></li>
<li><img src="http://www.importantworkstuff.com/Images/ForumMenu/links.gif"/>&nbsp;<a href="http://www.youtube.com/" TARGET="_blank">YouTube</a></li>
</font>
</div></div>';


*Waits for the earth to tremble at the might cheer made for the geek*  ;)
Hope it works well for you mrbean.

Resident Geek

I've put the menu up on my company's Development Forum and it's a hit!  8)
Nice menu Mr.Bean!

Here's a screen shot of what mine looks like:


Resident Geek

#36
Oops! Hey man, I just realized, there was an error in the CSS and your code. I've got it fixed in my code, but I'm not wanting to have to go back through your code. I'll just give you mine, and anyone who wants the code, can take the CSS file and the code here, and hack it to their own website. Have fun folks!

By the way, I've added a few tweeks of my own to the CSS so that it does more when you hover on the current link.

CSS code:
#iwsmainmenu ul
{
width: 150px;
font-size: 90%;
margin: 0;
padding: 0;
border: none;
list-style-type: none;
text-align: left;
}

#iwsmainmenu ul li a
{
width: 150px;
font-size: 90%;
margin: 0;
padding: 0;
border: none;
background: transparent url(http://www.yoursite.com/Images/ForumMenu/list-off.gif) left center no-repeat;
padding-left: 15px;
text-align: left;
font: normal 11px "Lucida Grande", "Lucida Sans Unicode", verdana, lucida, sans-serif;
text-decoration: none;
color: #999;
}

#iwsmainmenu ul li a:hover
{
width: 150px;
font-size: 90%;
margin: 0;
padding: 0;
border: none;
background: transparent url(http://www.yoursite.com/Images/ForumMenu/list-on.gif) left center no-repeat;padding-left: 15px;
text-align: left;
font: normal 11px "Lucida Grande", "Lucida Sans Unicode", verdana, lucida, sans-serif;
text-decoration: none;
color: black;
}

#iwsmainmenu ul li a#current
{
font-weight: 400;
background: transparent url(http://www.yoursite.com/Images/ForumMenu/list-on.gif) left center no-repeat;padding-left: 15px;
color: black;
}

#iwsmainmenu ul li a#current:hover
{
font-weight: 400;
background: transparent url(http://www.yoursite.com/Images/ForumMenu/list-active.gif) left center no-repeat;padding-left: 15px;
color: orange;
}



Menu code:

//Lets start by making a simple header and loading the css
echo '<LINK REL="stylesheet" TYPE="text/css" HREF="http://www.yoursite.com/forum/themes/default/mainmenucss.css">
<div class="smalltext">
<div id="iwsmainmenu">
<ul id="navlist">
<font size="2"><b>Navigation</b></font>
<hr>
<font size="1">';

// find out the domain
$domain = $_SERVER['HTTP_HOST'];
// find out the path to the current file:
$path = $_SERVER['SCRIPT_NAME'];
// find out the QueryString:
$queryString = $_SERVER['QUERY_STRING'];
// put it all together:
$url = "http://" . $domain . $path . "?" . $queryString;

//Are we on the index page now?
if ($url == 'http://www.yoursite.com/forum/index.php?')
{
//If so then display the link as the "current" id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/home.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?" id="current">Development Portal</b></a></li></html>';
}
else
{

//If not then display the link as the default id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/home.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php">Development Portal</a></li></html>';
}

//Are we on the forum page now?
if ($url == 'http://www.yoursite.com/forum/index.php?action=forum')
{
//If so then display the link as the "current" id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/forum.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=forum" id="current">Development Forum</b></a></li></li></html>';
}
else
{

//If not then display the link as the default id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/forum.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=forum">Development Forum</a></li></html>';
}

//Are we on the download page now?
if ($url == 'http://www.yoursite.com/forum/index.php?action=tpmod;dl')
{
//If so then display the link as the "current" id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/archive.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=tpmod;dl" id="current">Downloads</b></a></html>';
}
else
{

//If not then display the link as the default id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/archive.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=tpmod;dl">Downloads</a></html>';
}

//This will be a straight link to the wiki
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/rss.gif" />&nbsp;<a href="http://www.yoursite.com/wiki/">Development Wiki</a></font></html>
<br>
<font size="2"><b>Services</b></font>
<hr>
<font size="1">';


//Are we on the profile page now?
if ($url == 'http://www.yoursite.com/forum/index.php?action=profile')
{
//If so then display the link as the "current" id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/cp.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=profile" id="current">Profile</b></a></html>';
}
else
{

//If not then display the link as the default id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/cp.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=profile">Profile</a></html>';
}


//Are we on the members list page now?
if ($url == 'http://www.yoursite.com/forum/index.php?action=mlist')
{
//If so then display the link as the "current" id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/members.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=mlist" id="current">Members List</b></a></html>';
}
else
{

//If not then display the link as the default id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/members.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=mlist">Members List</a></html>';
}

//Are we on the whos online page now?
if ($url == 'http://www.yoursite.com/forum/index.php?action=who')
{
//If so then display the link as the "current" id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/online.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=who" id="current">Who\'s Online?</b></a></html>';
}
else
{

//If not then display the link as the default id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/online.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=who">Who\'s Online?</a></html>';
}

//Are we on the stats page now?
if ($url == 'http://www.yoursite.com/forum/index.php?action=stats')
{
//If so then display the link as the "current" id
echo '<li><img src="http://www.yoursite.com/Images/forumMenu/stats.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=stats" id="current">Statistics</b></a><alignment=left><br>
<ul id="navlist">
<BR>
<font size="2"><b>Help and Support</b></font>
<hr>
<font size="1">';
}
else
{

//If not then display the link as the default id
echo '<li><img src="http://www.yoursite.com/Images/forumMenu/stats.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=stats">Statistics</a><br>
<ul id="navlist">
<BR>
<font size="2"><b>Help and Support</b></font>
<hr>
<font size="1">';
}





//Are we on the search page now?
if ($url == 'http://www.yoursite.com/forum/index.php?action=search')
{
//If so then display the link as the "current" id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/search.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=search" id="current">Search</b></a></html>';
}
else
{

//If not then display the link as the default id
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/search.gif"/>&nbsp;<a href="http://www.yoursite.com/forum/index.php?action=search">Search</a></html>';
}

//This will be a straight link to the wiki
echo '<html><li><img src="http://www.yoursite.com/Images/forumMenu/faq.gif" />&nbsp;<a href="http://www.yoursite.com/wiki/">Knowledge Base</a></font></html>
</font>
</div></div>';



It took a while but here it is.


mrbean17

Awesome job, I'll play with it in a bit but could you please remove my address from the css?

Thanks

mrbean17

Mind linking or PM'ing me your site? I'd like to see what you changed ... I can't really get to mine yet, but will later today.

Resident Geek

Sure, I'll send you a link.
Sorry, I didn't realize I had your site in the CSS, I'll remove that now.

This website is proudly hosted on Crocweb Cloud Website Hosting.