alwaysme Posted January 10, 2008 Share Posted January 10, 2008 hi ppl i have a simple php file that will display to me 4 pictures and works fine <?php require('header2.php'); $query_mv = "SELECT * FROM pp_files WHERE approved='1' AND reject='0' ORDER BY ID DESC LIMIT 4"; $result_mv = mysql_query($query_mv); while ($row_mv = mysql_fetch_assoc($result_mv)){ echo "<a href=\"videos.php?id=".$row_mv["id"]."\"><img height='65' width='90' src=\"".$row_mv["picture"]."\" class=\"thumbnail\" alt=\"thumbnail\" /></a><Br> \n"; } mysql_close($mysql_link); ?> i also have a portal made from a forum software...a little below is the code for portal.php what id like to do is have the output of that code above in the contents of my portal.php....the portal points to an html file (portal.html, as u can see at the end of the code below).....i know some parts need to go in portal.php and some in the html file to make it display correct....but im not familiar how to seperate the above code and put what in portal.html and what in portal.php <?php $phpbb_root_path = './'; //define('PHPBB3_PORTAL_V', '1.0.1.b'); define('IN_PHPBB', true); $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'portal/config.'.$phpEx); include($phpbb_root_path . 'portal/includes/functions.'.$phpEx); // Start session management $user->session_begin(); $auth->acl($user->data); $user->setup('portal'); // // include all block // // only registered user see blocks if ($user->data['is_registered']) { include($phpbb_root_path . 'portal/block/user_menu.'.$phpEx); } else { include($phpbb_root_path . 'portal/block/login_box.'.$phpEx); } // other blocks include($phpbb_root_path . 'portal/block/search.'.$phpEx); include($phpbb_root_path . 'portal/block/recent.'.$phpEx); include($phpbb_root_path . 'portal/block/news.'.$phpEx); include($phpbb_root_path . 'portal/block/most_poster.'.$phpEx); // [+] choose style $sql = 'SELECT style_id, style_name, style_copyright FROM ' . STYLES_TABLE . ' WHERE style_active = 1 ORDER BY style_name DESC'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('styles', array( 'STYLE_ID' => $row['style_id'], 'STYLE_NAME' => $row['style_name'], 'STYLE_COPY' => $row['style_copyright'], 'U_STYLE' => append_sid("{$phpbb_root_path}portal.$phpEx", 'style=' . $row['style_id']), )); } $db->sql_freeresult($result); // [-] choose style /* // Assign specific vars $template->assign_vars(array( ) ); */ // output page page_header($user->lang['PORTAL']); $template->set_filenames(array( 'body' => 'portal/portal.html') ); make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); page_footer(); ?> thanks you so much Quote Link to comment https://forums.phpfreaks.com/topic/85289-simple-stuff-im-not-familiar-with/ Share on other sites More sharing options...
alwaysme Posted January 10, 2008 Author Share Posted January 10, 2008 <?php require('header2.php'); $query_mv = "SELECT * FROM pp_files WHERE approved='1' AND reject='0' ORDER BY ID DESC LIMIT 4"; $result_mv = mysql_query($query_mv); while ($row_mv = mysql_fetch_assoc($result_mv)){ echo "<a href=\"videos.php?id=".$row_mv["id"]."\"><img height='65' width='90' src=\"".$row_mv["picture"]."\" class=\"thumbnail\" alt=\"thumbnail\" /></a><Br> \n"; } mysql_close($mysql_link); ?> if i place the in the html file echo "<a href=\"videos.php?id=".$row_mv["id"]."\"><img height='65' width='90' src=\"".$row_mv["picture"]."\" class=\"thumbnail\" alt=\"thumbnail\" /></a><Br> \n"; } and this in the php file $query_mv = "SELECT * FROM pp_files WHERE approved='1' AND reject='0' ORDER BY ID DESC LIMIT 4"; $result_mv = mysql_query($query_mv); while ($row_mv = mysql_fetch_assoc($result_mv)) i recieve so many errors...anybody want to make me happy today please and directme Quote Link to comment https://forums.phpfreaks.com/topic/85289-simple-stuff-im-not-familiar-with/#findComment-435245 Share on other sites More sharing options...
Ken2k7 Posted January 10, 2008 Share Posted January 10, 2008 Uh, I don't know how phpBB works, but what are the errors? Quote Link to comment https://forums.phpfreaks.com/topic/85289-simple-stuff-im-not-familiar-with/#findComment-435246 Share on other sites More sharing options...
alwaysme Posted January 10, 2008 Author Share Posted January 10, 2008 the small script i pasted has nothing to do with phpbb...i just want to integrate the script which displays 4 pictures into the output portal page i just need to disect this code <?php require('header2.php'); $query_mv = "SELECT * FROM pp_files WHERE approved='1' AND reject='0' ORDER BY ID DESC LIMIT 4"; $result_mv = mysql_query($query_mv); while ($row_mv = mysql_fetch_assoc($result_mv)){ echo "<a href=\"videos.php?id=".$row_mv["id"]."\"><img height='65' width='90' src=\"".$row_mv["picture"]."\" class=\"thumbnail\" alt=\"thumbnail\" /></a><Br> \n"; } mysql_close($mysql_link); ?> and not sure which half goes into the .HTML file and which half into the .PHP file anybody knows what mean by this?? Quote Link to comment https://forums.phpfreaks.com/topic/85289-simple-stuff-im-not-familiar-with/#findComment-435259 Share on other sites More sharing options...
priti Posted January 10, 2008 Share Posted January 10, 2008 the small script i pasted has nothing to do with phpbb...i just want to integrate the script which displays 4 pictures into the output portal page i just need to disect this code <?php require('header2.php'); $query_mv = "SELECT * FROM pp_files WHERE approved='1' AND reject='0' ORDER BY ID DESC LIMIT 4"; $result_mv = mysql_query($query_mv); while ($row_mv = mysql_fetch_assoc($result_mv)){ echo "<a href=\"videos.php?id=".$row_mv["id"]."\"><img height='65' width='90' src=\"".$row_mv["picture"]."\" class=\"thumbnail\" alt=\"thumbnail\" /></a><Br> \n"; } mysql_close($mysql_link); ?> and not sure which half goes into the .HTML file and which half into the .PHP file anybody knows what mean by this?? .HTML will receive echo "<a href=\"videos.php?id=".$row_mv["id"]."\"><img height='65' width='90' src=\"".$row_mv["picture"]."\" class=\"thumbnail\" alt=\"thumbnail\" /></a><Br> \n"; This code snippet simply query table pp_files WHERE approved='1' AND reject='0' .and then the echo statement will echo on the page. i.e Image . Quote Link to comment https://forums.phpfreaks.com/topic/85289-simple-stuff-im-not-familiar-with/#findComment-435296 Share on other sites More sharing options...
alwaysme Posted January 10, 2008 Author Share Posted January 10, 2008 hi...maybe i didnt mention im very new to php so i paste this EXACTLY as is in the top of my portal.php? require('header2.php'); $query_mv = "SELECT * FROM pp_files WHERE approved='1' AND reject='0' ORDER BY ID DESC LIMIT 4"; $result_mv = mysql_query($query_mv); while ($row_mv = mysql_fetch_assoc($result_mv)) { and in my html i paste this <?php echo "<a href=\"videos.php?id=".$row_mv["id"]."\"><img height='65' width='90' src=\"".$row_mv["picture"]."\" class=\"thumbnail\" alt=\"thumbnail\" /><Br> \n"; ?> ? Quote Link to comment https://forums.phpfreaks.com/topic/85289-simple-stuff-im-not-familiar-with/#findComment-435521 Share on other sites More sharing options...
priti Posted January 11, 2008 Share Posted January 11, 2008 hi, how your html file understand $row_mv????? Looking at your first post look in the second file you have something like .... $template->assign_block_vars. here you assign the variables to template which you are trying to see.I don't know which template engine are you using but check how 'STYLE_ID' is been displayed in your portal.html. and i hope if you can understand the second file code you will understand that how you have to go ahead. The query and the result has to be fetched in your portal.php and then you have to assign them in var or array depending on your template engine and use them in profile.html and you would be able see the output. Regards, Quote Link to comment https://forums.phpfreaks.com/topic/85289-simple-stuff-im-not-familiar-with/#findComment-436292 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.