Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
hinksta
Worker
Worker



Joined: Dec 23, 2005
Posts: 226
Location: UK

PostPosted: Sat Dec 31, 2005 2:25 pm Reply with quote

Trying to learn, trying to make a block

I have links to topics and articles sorted but can't find the right names or code to add these items.

1: topic image
Code:
img src=\"$topicimage\"

2: topic alt
Code:
alt=\"$topicname\"

3: To show what I think is called hometext (the begining of a news item)
4: readmore (no idea)

If you could help push me in the right direction, that would be great.
 
View user's profile Send private message Visit poster's website
hinksta







PostPosted: Sat Dec 31, 2005 3:15 pm Reply with quote

OK got it all done apart from getting the topic image to show up.

Code:
$sql2 = "SELECT topicimage, topictext FROM ".$prefix."_topics WHERE topicid='$topic'";

$query2 = $db->sql_query($sql2);
list($topicimage, $topictext) = $db->sql_fetchrow($query2);


  $content .= "<td width=\"2%\">&nbsp;</td>
    <td width=\"100\" >
   <a href=\"".$art_link."new_topic=$topic\"><img src=\"$tipath, $topicimage\" alt=\"$topictext\" hspace=\"0\" vspace=\"0\" border=\"0\" width=\"90\" height=\"30\" align=\"left\"></a></td>


is this even close?
 
hinksta







PostPosted: Sun Jan 01, 2006 7:26 am Reply with quote

I must be missing something

still can't see the image on the page


Last edited by hinksta on Wed Jan 04, 2006 5:27 pm; edited 1 time in total 
hinksta







PostPosted: Sun Jan 01, 2006 7:54 am Reply with quote

had this bit of code messing it up

Code:
$tipath = intval($row['tipath']);


took it out and replaced

Code:
img src=\"$tipath, $topicimage\"


with

Code:
img src=\"$tipath$topicimage\"


that's it, my first block, Done

Wave

Could any master's out there mark my code?
 
hinksta







PostPosted: Wed Jan 04, 2006 4:32 pm Reply with quote

I think it's a bit buggy

I get a duplicate of the hometext followed by > before the title if next line (RETURN) is used
I also get > before title if a full stop is used

Code:
if(!defined('BLOCK_FILE')) { die("Illegal File Access Detected!!"); }

global $prefix, $tipath, $multilingual, $currentlang, $db;
list($main_module) = $db->sql_fetchrow($db->sql_query("SELECT `main_module` FROM `".$prefix."_main`"));
if($main_module == "News") {
  $art_link = "index.php?";
  $art_form = "index.php";
} else {
  $art_link = "modules.php?name=News&amp;";
  $art_form = "modules.php?name=News";
}
include_once("includes/nsnne_func.php");
$neconfig = ne_get_configs();
if($multilingual == 1) {
  $querylang = "WHERE (`alanguage`='$currentlang' OR `alanguage`='')";
} else {
  $querylang = "";
}
$content = "<table width=\"99%\" cellpadding=\"0\" cellspacing=\"1\" border=\"0\" align=\"center\">";
$result = $db->sql_query("SELECT * FROM `".$prefix."_stories` $querylang ORDER BY `sid` DESC LIMIT 0,5");
while($row = $db->sql_fetchrow($result)) {
  $sid = intval($row['sid']);
  $title = stripslashes(ne_check_html(ne_convert_text($row['title']), 0));
  $comtotal = intval($row['comments']);
  $counter = intval($row['counter']);
  $topic = intval($row['topic']);
  $hometext = stripslashes(check_html($row['hometext'], "nohtml"));
  $topictext = stripslashes(check_html($row['topictext'], "nohtml"));
  $topicimage = stripslashes(check_html($row['topicimage'], "nohtml")); 
$sql2 = "SELECT topicimage, topictext FROM ".$prefix."_topics WHERE topicid='$topic'";
$query2 = $db->sql_query($sql2);
list($topicimage, $topictext) = $db->sql_fetchrow($query2);
  $content .= "<td width=\"2%\"></td>
    <td width=\"17%\" >
   <a href=\"".$art_link."new_topic=$topic\"><img src=\"$tipath$topicimage\" alt=\"$topictext\" hspace=\"0\" vspace=\"0\" border=\"0\" width=\"90\" height=\"30\" align=\"left\"></a>
   </td>
    <td align=\"left\" width=\"60%\"><a href=\"".$art_link."op=NEArticle&amp;sid=$sid\"><strong>$title</strong></a></td>
    <td width=\"20%\"></td>
    <td width=\"0%\"></td>
  </tr>
  <tr>
    <td></td>
    <td colspan=3><".$hometext.">$hometext</td>
    <td></td>
  </tr>
  <tr>
    <td></td>
    <td></td>
    <td></td>
    <td><a href=\"".$art_link."op=NEArticle&amp;sid=$sid\"> (<em>Read More... </em>)</a></td>
    <td></td>
  </tr>
  ";
}
$content .= "</table>";
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©