Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

php help


  • Please log in to reply

#1
l0st.en.Drago

l0st.en.Drago

    Member

  • Member
  • PipPip
  • 61 posts
Hi, I need some basic help. These div classes are how I want the php to display in view_msgs.php but right now it's just normal text. How can I include my styles in php? :)

this is index.php
[codebox]
<div style="position: absolute; left: 163px; top: 432px; width: 430px; background-color: transparent;">
<MTEntries lastn="7">
<?php @ require_once ("view_msgs.php"); ?>

<div class="style2">Date </div>
<div class="style3">Show new blog title</div>
<div class="style1">body of blog</div>
<div align="right">click to comment</strong></b><p>
</MTEntries>
</div>
[/codebox]
  • 0

Advertisements


#2
l0st.en.Drago

l0st.en.Drago

    Member

  • Topic Starter
  • Member
  • PipPip
  • 61 posts
no help?
  • 0

#3
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
please be patient - some of us type with one finger.

try this(insert the php code inside the <div>):


<div class="style2">
<?php
echo " abc "
?>
</div>
  • 0

#4
l0st.en.Drago

l0st.en.Drago

    Member

  • Topic Starter
  • Member
  • PipPip
  • 61 posts
OK this is my index.php & view_msgs.php and it's not my script but I want to build off it to learn. But I seriously bought a new keyboard because I just dont understand.

I would like to thank you bdlt for your reply. Now in index.php I want to view the message. Can anyone show me how to do this and explain in a little note or something?

<div style="position: absolute; left: 163px; top: 432px; width: 430px; background-color: transparent;">
<MTEntries lastn="7">
<div class="style2">Date </div>
<div class="style3">Show new blog title</div>
<div class="style1">body of blog</div>
<div align="right">click to comment</strong></b><p>
</MTEntries>
</div>

<?php
  
  // include db file & functions
  include_once("class/db.inc.php");
  include_once("functions/functions.inc.php");
  
  // create new db object
  $db = new Blog_MySQL;
?>
<html>
<head>
  <title>Blog - messages</title>
  <link href="css/blog.css" rel="stylesheet" type="text/css" media="all" />
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<table cellpadding="0" cellspacing="0" border="0" class="tbl-blog">
<tr>
<td colspan="2" style="background:#444;color:#eee;font-weight:bold;font-size:11px;">Blog messages</td>
</tr>
<?php
  
  // grab messages
  $res_id = $db->_query_select("SELECT * FROM blog ORDER BY blog_date DESC");
  
  $i = 0;
  $link = "";
	
  // Display records
  while ($row = $db->_fetch_array($res_id)) {
	$code_array = get_msg_code();
	if ($code_array) {
	  if (in_array($row['blog_code'],$code_array)) {
		$link = "<a class=\"blog-link\" href=\"del_msg.php?code=" . $row['blog_code'] . "&amp;id=" .$row['blog_id'] . "\">delete</a>";
	  } else {
		$link = "";
	  }
	}
	if ($row['blog_email']!="") {
	  $name = "<a class=\"blog-link-mail\" href=\"mailto:" . $row['blog_email'] . "\">" . $row['blog_name'] . "</a>";
	} else {
	  $name = $row['blog_name'];
	}
	  print "<tr class=\"row-style-" . row_style($i) . "\">\n";
	print "<td class=\"title\">By: <b>" . $name . "</b></td>\n<td class=\"title\" align=\"right\">". $link ."</td>\n";
	print "</tr>\n";
	print "<tr class=\"row-style-" . row_style($i) . "\">\n";
	print "<td colspan=\"2\" class=\"msg\"><span style=\"font-size:8pt;color:#777;\">posted on " . format_date($row['blog_date']) . "</span><br />" . $row['blog_msg'] . "</td>\n";
	print "</tr>\n";
	$i++;
  }
  
  // close connection
  $db->_close();
?>
</tr>
</table>
</body>
</html>

  • 0

#5
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
Hi l0st.en.Drago,

I'm a little confused(a normal state).

So do we want to simply show text as style2?
or did I miss the bus?

bdlt
  • 0

#6
l0st.en.Drago

l0st.en.Drago

    Member

  • Topic Starter
  • Member
  • PipPip
  • 61 posts
No you're on the right bus.. :)
  • 0

#7
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
ok ... what text are we displaying?
  • 0

#8
l0st.en.Drago

l0st.en.Drago

    Member

  • Topic Starter
  • Member
  • PipPip
  • 61 posts
Basically, its a blog. So right now in the working version it shows:

By: Username
posted on 18.02.08 @ 01:18
Hello World(and this is the message)
  • 0

#9
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
1. let's start with the 'style' code
print "<tr class=\"row-style-" . row_style($i) . "\">\n";

try changing each row_style($i) to row_style[ $i ].

2. color:#777 is not a browser safe color. it may look ok with your browser but may be shown differently with another browser.

http://www.w3schools...html_colors.asp
  • 0

#10
l0st.en.Drago

l0st.en.Drago

    Member

  • Topic Starter
  • Member
  • PipPip
  • 61 posts
That's where this comes in because the style from the script is not the style I want.
<div style="position: absolute; left: 163px; top: 432px; width: 430px; background-color: transparent;">
 <MTEntries lastn="7"> 
 <div class="style2">Date </div>
 <div class="style3">Show new blog title</div> 
 <div class="style1">assadfkljdfjslkjfdlksjdf</div> 
 <div align="right">click to comment</strong></b><p> 
 </div>

Can I ask you a question? What is the difference from: row_style($i) to row_style[ $i ]. and does the period need to have a space? row_style[ $i ] . ??
  • 0

Advertisements


#11
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
ignore the period - it was part of the reply, not part of the code

if row_style() is a function defined in the included files, then leave it alone

it didn't occur to me at the time that it might be a function

let me look more at the style code and will get back with you later today(in 3-4 hours)
  • 0

#12
l0st.en.Drago

l0st.en.Drago

    Member

  • Topic Starter
  • Member
  • PipPip
  • 61 posts
OK thanks bdlt. :)
  • 0

#13
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
here's an example of style code using classes. 'style1' is similar to one of your DIVs.



[codebox]
print "<html><head>";
print '<style type="text/css"><!--';
print ".italic {font-style: italic}";
print ".style0 {font-weight: bold; color:cyan}";
print ".style1 {position: absolute; left: 163px; top: 232px; width: 430px; background-color: transparent; color: brown}";
print "--></style>";
print "</head><body>";
print '<P style="font-size: 12pt; color: fuchsia">style sheet example</p>';
print '<P style="font-size: 14pt; color: blue">style sheet example</p>';
print '<div style="font-size: 16pt; color: red">style sheet example</div>';
print '<div class="italic">style sheet example</div>';
print '<div class="style0">style sheet example</div>';
print '<div class="style1">style sheet example</div>';

print "</body></html>";[/codebox]
  • 0

#14
l0st.en.Drago

l0st.en.Drago

    Member

  • Topic Starter
  • Member
  • PipPip
  • 61 posts
I'm just going to give you everything. Look; it messed everything up. The only css I want to use is in my main.css
I attached both main and blog.css check my attachments.
Blog, I dont want that css code. Is there a way I can just delete view_msgs and have it intergraded in the index.php ?? here is ALL of index.php

<html>
<head>
<link href="css/main.css" rel="stylesheet" type="text/css" media="all" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>.l0st title</title> 
 <div style="position: absolute; top: 8px; left: 163px;"> 
 <img src="../img/banner.jpg"> 
 </div> 
 <div style="position: absolute; left: 163px; top: 432px; width: 430px; background-color: transparent; height: 88px;">
 <MTEntries lastn="7"> 
 <div class="style2">Date of my post</div>
 <div class="style3">Show new blog title</div> 
 <div class="style1">This is where my post should be.</div> 
 <div align="right">click to comment </div>
 </MTEntries> 
 </div> 
 
 <div style="position: absolute; left: 600px; top: 433px; width: 231px; background-color: transparent;"> 
 <div class="style2"><span class="gimmemor">..Yet another blog</span>.</div> 
 <div class="style3">by Me.</div> 
 <div class="style1">this is where I can have a little about me</div> 
 
 <br> 
 
 <div class="style2">this</div> 
 <div class="style3"><span class="style3">is his blog </span>.</div> 
 <div class="style1">Finish this blog</div> 
 
 <br> 
 
 <div class="style2">a list</div> 
 <div class="style3">with links.</div> 
 <div class="style1"> 
 
 <a href="http://www.youtube.com">links here</a>
 
 
 </div> 
 
 <br> 
 
 <div class="style2">Actions Speak louder<br>
 </div> 
 <div class="style3">hear his testimonials.</div> 
 
 comment code here, comment code here, comment code here
 
 <br> 
 
 <div class="style2">Only time can tell  </div> 
 <div class="style3">the archives.</div> 
 <div class="style1"></div> 
 
 <br> 
</div> 
</div> 
</head></html>

I never really said thank you. I really appreciate you helping me this far.
  • 0

#15
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
you are welcome.

to be clear - we want to:
1. remove all references to blog.css
2. remove all references to view_msgs
3. leave main.css alone

let me take a look. I will send a status report in 1-2 hours.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP