Jump to content

doddsey_65

Members
  • Posts

    902
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by doddsey_65

  1. good question, i forgot to mention that the header has the name of the forum within it, which is grabbed from the query
  2. The current system I am using has worked so far but it has its problems. Basically I have 2 files to display forum topics. view_topics.php and topic_list_tpl.php view_topics.php defines some variables like so $template->topic_name = $row[$key]['topic_name'] then it renders the page like so $template->render('topic_list_tpl.php'); then in topic_list_tpl.php i use this to print the name of the topic <?php echo $this->topic_name; ?> which works fine. But as you know a topic list needs a header. But the render function is within a foreach loop so it displays all of the topics from the query. This poses the problem of the header being looped, which it shouldnt be. So in view_topics.php i use: $template->topic_id = $row[$key]['topic_id']; $template->first_topic_id = $row[0]['topic_id']; then in topic_list_tpl.php i can use: <?php if($this->topic_id == $this->first_topic_id) { echo the header } else { echo the topics } but the problem comes when adding a footer bar at the bottom(for the new reply link and other topic options). i can use something like $amount_of_topics = count($row); $template->last_topic_id = $row[$amount_of_topics-1]['topic_id'] and then check it like that but that wont work when using pagination as the last topic displayed isnt always going to be the last topic in the query. So another option i have is to have the header and footer bars in seperate files and call them outside of the loop. But these files would only be 2 or 3 lines each. So is this the best option? or is there an easier way of doing things?
  3. Hi, im trying to set up a tooltip whereby the user hovers over a forum name and it shows the first 5 topics within that forum in the tooltip. However i cant get it to display the topics properly. It just displays the same topics in all tooltips(3 in total). $topic_preview = array(); $query = $link->query("SELECT f.*, t.t_name FROM ".TBL_PREFIX."forums f LEFT JOIN ".TBL_PREFIX."topics as t ON (t.t_fid = f.f_fid) GROUP BY f.f_fid ORDER BY f.f_fid ASC")or die(print_link_error()); while($row = $query->fetch(PDO::FETCH_ASSOC)) { $topic_preview[] = $row['t_name']; } echo implode('<br />', $topic_preview); anyone have any ideas? Thanks
  4. I was recently told that using jQuery as pagination is making ASF slower and is an unneeded feature. Does anyone agree with this?
  5. without seeing any code its hard to offer help
  6. Im trying to use a cropping feature but when the image is cropped the alpha channel is lost. Anyone know where im going wrong here? if($ext == 'png') { $srcImg = imagecreatefrompng('avatars/'.$original); $newImg = imagecreatetruecolor($width, $height); imagealphablending($srcImg, true); imagesavealpha($srcImg, true); imagecopyresampled($newImg, $srcImg, 0, 0, $x1, $y1, $width, $height, $width, $height); imagepng($newImg, 'avatars/'.$user_name.'_avatar_cropped.png'); $link->query("UPDATE ".TBL_PREFIX."users SET u_avatar_cropped = '".$user_name."_avatar_cropped.png' WHERE u_username = '$user_name'") or die(print_link_error()); }
  7. Thanks for the reply Paul. Any problems that are brought to my attention will be high priority and will be fixed first before moving on to other sections.
  8. ive just added a notification system where you can subscribe to topics and get email notifications when new replies are made. Its in its basic form atm but i will be expanding on it tomorrow.
  9. replied and fixed most issues. Thanks
  10. Just a side note, you will not be able to edit your signature since i have gotten rid of CKEditor and havent replaced it in that section either. it will throw up some javascript errors on that page which means some other features on the same page(upload avatar, crop avatar) which rely on JS will not work either.
  11. I will take your advice into consideration thanks. Anything to help improve ASF is greatly appreciated. As for helping, i am in need of some testing done. I have always needed to test ASF but since i deleted the files and retrieved them they were incomplete and old copies. So sections that used to work may not anymore. The best thing you could do for me is to make a topic or two, edit your user settings via the user center, upload an avatar and crop it etc. If i know all of these things actually work then i can sleep easier lol. Thanks!
  12. yeh i havent sorted out the pages for category displays yet. To create a new post you will need an account with asf. You can register here: http://www.asimpleforum.co.uk/register Once you have registered there will be a bar at the bottom of the screen when viewing posts or topic threads that says new reply.
  13. Im building an advanced search feature and its mostly going fine. The only problem is that results are displayed more times than they need to be. I have a test post in the database: p_name p_content Testing Advanced Search This is to test the advanced search When i do a search with the keywords "testing advanced search" and set it to match any keywords it does bring up this post as it should do. But it is displaying it 3 times when there is only one instance of it in the database. here is my code: $match = $_POST['match']; // for this example match === any $keywords = $_POST['keywords']; // for this example keywords === testing advanced search $within = $_POST['within']; // for this example within === p_c (post_content only) switch($within) { case 'p_s_c': default: $sql_match = 'p.p_name, p.p_content'; break; case 'p_c': $sql_match = 'p.p_content'; break; case 'p_s': $sql_match = 'p.p_name'; break; case 't_t': $sql_match = 't.t_name'; break; } $match === 'all' ? $keywords = '"'.$keywords.'"' : $keywords = $keywords; $query = $link->query("SELECT p.*, t.* FROM ".TBL_PREFIX."posts as p JOIN ".TBL_PREFIX."topics as t WHERE MATCH ($sql_match) AGAINST('$keywords' IN BOOLEAN MODE)") or die(print_link_error()); while($row = $query->fetch(PDO::FETCH_ASSOC)) { $return = preg_split('|, |', $sql_match); for($i=0; $i<count($return); $i++) { $return[$i] = substr($return[$i], 2); echo '<p>Results: '.$row[$return[$i]].'</p>'; } } And here is the echoed query: SELECT p.*, t.* FROM asf_posts as p JOIN asf_topics as t WHERE MATCH (p.p_content) AGAINST('Testing advanced search' IN BOOLEAN MODE) Any help?
  14. added a lot of new updates to the site. These include some small graphical changes and some new features which include the new ASF bbeditor. More info can be found here: http://www.asimpleforum.co.uk/category/development/forum/news/topic/file_updates
  15. i dont know about the first one, to test my validation i add the files to a live server
  16. dont know about the SMTP thing but as for the login page. You are getting the undefined variable message because you havent included session_start() at the top of the page. The second message is due to this: if (mysql_query($login)==0) try using: if (mysql_num_rows($login)==0)
  17. doddsey_65

    Regex

    im trying to convert bbcodes into html for a preview but came across a problem. The bbcode is . But within those tags are some <span>s that are used for syntax highlighting. So when i use my current regex it removes those spans: /\[code\](.*?)\[\/code\]/gi <pre><code class="php">$1</code></pre> is there anyway to keep everything between the tags? even the html code?
  18. ive added you on gmail. it is a rendering problem i think but its beyond me as to why its behaving as such
  19. its alot since i updated the database with new records but here is the dump of $cat array(2) { [0]=> array(9) { ["f_fid"]=> string(1) "8" ["p_id"]=> string(1) "0" ["f_name"]=> string(7) "Testing" ["f_description"]=> string(0) "" ["f_topics"]=> string(1) "0" ["f_posts"]=> string(1) "0" ["f_last_post"]=> NULL ["f_last_post_time"]=> NULL ["f_last_poster"]=> NULL } [1]=> array(2) { [0]=> array(10) { ["f_fid"]=> string(1) "2" ["p_id"]=> string(1) "1" ["f_name"]=> string(12) "New Features" ["f_description"]=> string(112) "This is the place to visit if you want to know what new feature have already been implemented. Updated Regularly" ["f_topics"]=> string(1) "9" ["f_posts"]=> string(2) "20" ["f_last_post"]=> string(21) "jQuery Pagination Fix" ["f_last_post_time"]=> string(10) "1298989371" ["f_last_poster"]=> string(9) "doddsey65" ["subforums"]=> NULL } [1]=> array(10) { ["f_fid"]=> string(1) "9" ["p_id"]=> string(1) "8" ["f_name"]=> string(15) "Test Playground" ["f_description"]=> string(134) "If you want to test some of the features ASF has to offer then this is the place to do so. Please don't test features in other forums." ["f_topics"]=> string(1) "1" ["f_posts"]=> string(1) "1" ["f_last_post"]=> string(13) "Testing Topic" ["f_last_post_time"]=> string(10) "1299012792" ["f_last_poster"]=> string(5) "spicy" ["subforums"]=> NULL } } } i did change it to $cat 1 but that just replaced the category name with the forum name and showed several categories for each forum each with the forum name. Here is the address for the github repository so you can have a better look. https://github.com/doddsey65/ASF-A-Simple-Forum/blob/master/functions/functions.php
  20. i have the $cat[1] part in another section and removed the above code as it seemed to make things worse. Here is my code: $cats = $forums = $cat_list = $cat_name = $nforums = $subforums = $this_forums = array(); $query = $link->query("SELECT * FROM ".TBL_PREFIX."forums")or die(print_link_error()); while($row = $query->fetch(PDO::FETCH_ASSOC)) { if($row['p_id'] == 0) { // these are root categories $cats[] = $row; } else { // these are all children, included sub-sub children, even sub-sub-sub children. $forums[$row['p_id']][] = $row; } } if(is_array($cats)) { foreach($cats as $cat) { if(is_array($forums[$cat['f_fid']])) { foreach($forums[$cat['f_fid']] as $forum) { // all of your forums children are loaded here. // you can even loop the sub forums and find the 4th node children $forum['subforums'] = $forums[$forum['f_fid']]; // Need to store this into the classes variable to be used globally. // View will later be decided on if there is a forum id set. $this_forums[] = $forum; } } } if(!empty($this_forums)) { $nforums[] = array($cat,$this_forums); } } foreach($nforums as $cat) { $template->f_c_name = $cat[0]['f_name']; $template->c_url_name = create_url($template->f_c_name); $template->is_cat = true; $template->render($template->template.'templates/forum_list_tpl.php'); if(is_array($cat[1])) { foreach($cat[1] as $forum) { $template->is_cat = false; if(!empty($forum['f_last_post'])) { $template->f_icon = $template->template.'icons/forum.png'; $template->f_last_post = $forum['f_last_post']; $template->f_last_poster = profile_link($forum['f_last_poster']); $template->f_last_post_time = asf_date($forum['f_last_post_time'],'full'); } else { $template->f_empty = true; $template->no_posts = $lang->no_posts; $template->no_posts_sub = $lang->be_first; $template->f_icon = $template->template.'icons/forum_empty.png'; } $template->f_name = $forum['f_name']; $template->f_url_name = create_url($template->f_name); $template->description = $forum['f_description']; if(is_array($forum['subforums'])) { foreach($forum['subforums'] as $child) { $template->s_url_name = create_url($child['f_name']); $subforums[] = '<a href="category/'.$template->c_url_name.'/forum/'.$template->s_url_name.'">'.$child['f_name'].'</a>'; $template->subforums = implode(' ',$subforums); unset($subforums); } } else { $template->subforums = null; } $template->render($template->template.'templates/forum_list_tpl.php'); } } } it only displays one cateogry(the last one) and displays all forums within that cat rather than in the cat they belong to.( i have 2 cats ) EDIT: i can supply you with a dump of my database table if that would help (project is open source anyway) or i can update github so you can see it there
  21. no i am still having the same problem
  22. can you show how you modified edit_user.php as the error jumped from line 3 to 4
  23. try using the disabled tag properly. Eg: instead of this: <input type="text" value="<?php echo $id;?>" name="idmembers" disabled/> use this: <input type="text" value="<?php echo $id;?>" name="idmembers" disabled="disabled" />
  24. your form method is POST so it should be $_POST['idMembers']
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.