This topic is locked

Sample forum template

1/20/2021 7:53:37 AM
PHPRunner Tips and Tricks
fhumanes author


The concept of the forum is somewhat old but I believe that in the current situation, where teleworking prevails and therefore communications between team members have declined, it can be an element of sharing ideas, concerns and solutions, and that can help improve team productivity and collaboration.
Also, in this case, I have done it at the request of a PHPRunner user who has requested support for this type of solution.
Functional Requirements

  • Users must have a photo. A drawing is set by default.
  • Users can be registered in the system autonomously, validating themselves through email.
  • The topics ("topics") must be classified by a category.
  • In the tray or lists of topics, they will be identified by tabs: All, those that the user is the author and those who have subscribed (selection of the topics that interest them)
  • The topics will be reported: The author (by photo), the creation date, the number of responses it has and the number of times it has been consulted.
  • All users will be able to start a topic and will be able to reply to any of them.
  • Authors will be able to change (edit and delete) any of their topics and their responses.
  • For the construction of the texts, a (powerful) html editor must be used and it will include the possibility of incorporating images and files into the system itself, being managed in individual directories of each of the users.


This solution is a basic system, which must be adjusted to the needs of the teams, expanding in aspects such as:

  • Control panel of the use that users make of the system. Interesting to promote the use and highlight the users who use it the most.
  • Need or not of a "moderator" of the forum.
  • User blocks that skip the terms of use
  • Sending by email summaries of the subscribed topics.


DEMO: https://fhumanes.com/forum
Users are encouraged to sign up.
Administrator user: "admin"/"admin"
Technical solution
I have used PHPRunner 10.4, so that it can be used by more users, since the user who requested it does not have version 10.5.
This same solution could be done with the same functionality in version 10.2
Data model
It is very simple, having this set of tables. The "profil" view has been used because a bug has been detected in the management of the images, it did not work well in a PHPRunner view (verified that it works well in version 10.5).


The configuration of the application has been done through a file "config.php" located in the "MyCode" directory and that is executed from the "After application initialized" event.



<?php

// Application configuration file

$_SESSION['PLUGIN_ICON'] = "mis_imagenes"; // Location of the icons

$_SESSION['PREF_LINK'] = "http://localhost/forum/files/"; // Pre URL for the location of User images
// Configuration editor "Innovation"

$_SESSION["UserID"] = $_SESSION["id_user"]; // User ID

$_SESSION['EDITOR_BaseVirtual0'] = "/forum/assets"."/".$_SESSION["UserID"];

$_SESSION['EDITOR_Base'] = "C:/Apache24/htdocs/forum/assets";

$_SESSION['EDITOR_Base0'] = $_SESSION['EDITOR_Base']."/".$_SESSION["UserID"];

$_SESSION['EDITOR_UrlBase'] = "http://localhost/forum/assets";

// Control diretory of images of User

$name_dir = $_SESSION['EDITOR_Base0']."/";
// Create Directory of images of the connected User

if (isset($_SESSION["id_user"]) ) { // A user is connected?

if (!file_exists($name_dir)) {

mkdir($name_dir, 0700);;

}

}

?>


The innovaeditor editor that is delivered with PHPRunner has been used, but it has had to be customized by:

  • Eliminate security problems, since it has URL's that access resources without having identified any user.
  • Settings so that users have a different directory for the resources (images and files) that they wish to incorporate into their topics or responses.
  • Multi-language support.


The changes I have made to the location of the PHPRunner installation (in my case C:\Program Files\PHPRunner10.4\source\plugins\innovaeditor) are:

  • In directory "C:\Program Files\PHPRunner10.4\source\plugins\innovaeditor\assetmanager":

    File "assetmanager.php", these lines are added.




<?php

include("settings.php");
// Control environment PHPRunner

$name_file = __DIR__."/phprunner_setting.php";

if (file_exists($name_file)) {

require __DIR__."/phprunner_setting.php";

}


  • The file "phprunner_setting.php" has been added with this content:






<?php

require_once("../../../include/dbcommon.php"); // DataBase PHPRunner
// Control user login

if (!isset($_SESSION["UserID"])) {

die("Please connect aplications");

}

// Config assetmanager

$bReturnAbsolute=false;

$sBaseVirtual0=$_SESSION['EDITOR_BaseVirtual0'];

$sBase0=$_SESSION['EDITOR_Base0'];
if ($_SESSION["language"] == "Spanish") {

$sLang="es-ES";

} else {

$sLang="en-US";

}


  • In directory "C:\Program Files\PHPRunner10.4\source":



Innova.php file (it is for multi-language management)





// FHP



if ($_SESSION["language"] == "Spanish") {

$sLang="es-ES";

$LangScript = '<script type="text/javascript" src="'. projectURL() . ("plugins/innovaeditor/scripts/language/".$sLang."/editor_lang.js").'"></script>';

} else {

$sLang="en-US";

$LangScript='';

}


Explanation of use


Default users can only view the topics and view their profile and change your name and photo.


This is the main screen of the system.
(1) .- The topics are presented in 3 tabs (all topics, the topics that I am the author and the topics that I have subscribed to).

(2) .- By checking the topics and the "subscription" and "unsubscribe" buttons, the user can have the topics they have chosen in a new tab.

(3) .- If you are the author of the subject, it facilitates the edition, and even the elimination of it.


(1) .- The title of the topic and the question or presentation that has been made appears at the beginning of the answer pages.

(2) .- Next come the answers, the last one, the first one on the list. As seen in the image, images, links, files, etc. can be included.


(1) .- Creation and editing is online and the innovaeditor editor is always used, with all its features.

(2) .- The save or cancel buttons are offered below the user information.


(1), (2) .- As indicated on different occasions, images and files can be uploaded. The resource repository is unique to each user. The editor interface can be adjusted to the required language.


(1), (2) and (3) .- I remind you, I have commented on it in other articles, that we can include in the editor any of the characteristics of Bootstrap 3, with which, for example, collapsible text or "accordion" type presentations.
As I always indicate, for any questions or explanations, you can contact me through my email [email="fernandohumanes@gmail.com"]fernandohumanes@gmail.com[/email]
Also, I leave you in my portal, the files so that you can reproduce the example on your computers.

ruzgarajans 1/22/2021

very successful . we thank you