Mi-Dia 0 Newbie Poster

On a project I am doing I am making a Feed Flow of recent updates. Problem is I cant find out to overcome the following.

There are two tables, shouts and journals. what I want to do is pull records from them both and print them out with the newest at the top and the oldest at the bottom.

I have tried every way and cant find how to do it, but heres the logic of what I am trying.

The two tables fields are

shouts = id, content, date, user
journals = id, content, title, date, user

SELECT * FROM shouts, journals ORDER BY id DESC;

While( $row = above statement )
{

if its a shout
{

print "Shout: $row";

} else {

print " Journal: $row <br> $row";

}

The final result of the flow should be something like

SHOUT
SHOUT
JOURNAL
SHOUT
JOURNAL

ect ect but at the moment all I can seem to get working is all journal or all shout


Any help Highly appreciated.


}

Mi-Dia 0 Newbie Poster

Thats where your wrong because it works perfect

Mi-Dia 0 Newbie Poster

nevermind, sorted it myself

Mi-Dia 0 Newbie Poster

Can someone help?

Mi-Dia 0 Newbie Poster

Anyone?

Mi-Dia 0 Newbie Poster

I am making a forum script, this part is basically parsing the html for the categories then the html for the rows inside. For some reason the forums repeat themsleves and I have tried everything to clear the values incudling $forum = ''; and unset($forum); but nothing is working, and 2 hours later all I have achieved is a majour headache, please help.

<?php

/***********************

Name: Mi-Dia (http://www.mi-dia.co.uk )

Author: Christopher Shaw

This file belongs to Mi-Dia, it may be freely modified but this notice, and all copyright marks must be left

intact. See COPYING.txt

************************/

$STYLE = new style();$tpl = $STYLE->open('forum/home.tpl');


$cat = $STYLE->getcode('category',$tpl);
$forumcode = $STYLE->getcode('row',$tpl);



if ( $account['level'] < '1') {$where = "AND staff = '0'"; $catw = "WHERE staff='0'";}else{$where="";$catw="";}





$postsql = mysql_query("SELECT * FROM ".$dbslave."." . $prefix . "_forum_cats $catw ORDER BY sort;");








while ($row = mysql_fetch_array( $postsql )) {

///FORUM
$cat_id = $row['id'];
$forumsql = mysql_query("SELECT * FROM ".$dbslave."." . $prefix . "_forum_forums WHERE cat_id = '$cat_id' AND parent_id = '0' $where ORDER BY sort;");


$forum='';
while ($forumrow = mysql_fetch_array( $forumsql )) { $forum = $STYLE->tags($forumcode,array("TOPIC" => $forumrow['name']));$class = 1 - $class;
/// FORUM




$cat .= str_replace($cat,$forum,$cat);}


$cat = str_replace($forumcode,'',$cat);






$category .= $STYLE->tags($cat,array("NAME" => $row['name']));

$class = 1 - $class;

}

$forum = '';


$catcode = $STYLE->getcode('category',$tpl);
$tpl = str_replace($catcode,$category,$tpl);
print '<BR>Origional: '.$catcode.'<br>orum Code:'.$forum.' <br>Unparsed: '.$cat.' <br>Parsed: '.$category.'<br>FINAL:'.$final;





print $forum;
$output .= $STYLE->tags($tpl,'');
?>

There is alot of debugging code in there, but I have added ////FORUM around the area of concern, please …

Mi-Dia 0 Newbie Poster

Thanks to a little guidance here I have written a function for getting part of a string returned.

function getcontent($tag,$string)
{
$pos1 = stripos($string, '<'.$tag.'>');
$pos2 = stripos($string, '<'.$tag.'>');
$content = substr($string, $pos1, $pos2);
return $content;
}
print $content('row','Hello world <row> bladh </row>');

output would be "bladh"

Mi-Dia 0 Newbie Poster

How would I go about doing that

Mi-Dia 0 Newbie Poster

Anyone, theres got to be a way to do this, it was done in phpbb2. Its not rocket science but looking through php.net I cant find the right function.

Mi-Dia 0 Newbie Poster

Anyone. I basically want to make it so I have 1 template file per page, and make a function to repeat a certain bit for rows or posts ect.

So I need a function where it can look at a string, find the html between the html comments then return it as a usable var

Mi-Dia 0 Newbie Poster

I looked at that first, but thats only replacing, what I need is the opposite.
Instead of replacing, I want it to find whats between the html comments and return it to me.

Mi-Dia 0 Newbie Poster

I am in the hard task of rewriting a template system, specificly to support repeating content of a forum script.

I am currently tyring this with a dummy file at the moment and I am stuck on one part.
What is basically does, is load the following html which has worked well, but what I need to do is a value where it cuts the html between 2 tags so I can use it to be repeated before reinserting.

$string = '<div class="boxone">Memberlist</div>

<!-- row -->
Username is {USERNAME}
<!-- row -->';

So in short, what I am looking to do is cut 'Username is {USERNAME}' out of the string, preferbly in a function, so I would end up with something similar to bellow

$snippet = bock('row',$string);
print $snippet; // outputs Username is {USERNAME}

Any help would be appreciated