Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2019-08-03 15:03:13

Vitaliy
New member
Registered: 2019-07-31
Posts: 3

[php][/php] bbcode

Good day. I need to embed PHP BB code with tags, for example [php] echo time (); [/ php]. Are there any ready-made methods, please tell me. (ru->en)

Offline

#2 2019-08-03 20:33:32

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,719
Website

Re: [php][/php] bbcode

Not that I know of. I would strongly advise against something like that, though - that seems like a huge security hole. wink


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#3 2019-08-04 11:47:27

Vitaliy
New member
Registered: 2019-07-31
Posts: 3

Re: [php][/php] bbcode

This feature is needed only for the administrator. It seems I managed to solve it simply smile

Offline

#4 2019-08-08 09:43:20

Vitaliy
New member
Registered: 2019-07-31
Posts: 3

Re: [php][/php] bbcode

I want to share. I needed to display a large table (~ 100kb) with the possibility of convenient periodic editing. Doing it manually is not a normal activity. As a result, I came to the conclusion that the scripts [html / js] and [php] are needed, I also had to add the ability to cache the table.
Result: the table is created with a small script, and to add or remove information, just edit the array.

(scitecforum.ru/viewtopic.php?pid=26)
[html]
<style>#elb {background: rgba(77, 111, 111, 0.2);}</style>
<div style="max-width:100%; height:23em; overflow:auto;">
<table>
[php]
$ss_tablestring = getstringcache('ss_tablestring_'.$cur_post[id], $cur_post[edited]);
if ($ss_tablestring != '')
	return $ss_tablestring;
$ss_elementinteraction = array('Se_A_Cd','Br_A_Ca','P_A_Zn','P_A_Mg','Mo_>_P','P_A_Mn','Cu_>_P','P_A_Al','P_A_Be','P_A_Ca','P_>_Na','P_A_Fe','Co_>_I','Co_>_Fe','N_>_Mo','Zn_>_Fe','Mg_>_Fe','Fe_A_K','Fe_A_Mn','Cu_>_Fe','Fe_A_Ca','S_C_Se','As_>_Se','Li_>_Na','Na_A_K','Cr_>_Ca','S_>_Ca','Ca_>_F','Ca_>_Zn','Ca_A_Mg','Ca_A_Mn','Ca_A_Cu','Ag_A_Cu','Cd_A_Zn','Cd_>_Cu','Al_>_F','S_>_Cu','Cu_A_Zn','Cu_A_Mo','Cu_A_Mn','Mn_C_Mg','Mn_A_K','K_A_Mg','Mo_A_S','F_A_I','As_>_I','Zn_>_S','H_#_H','Mg_C_S','Mo_C_Zn','Mo_C_Mn','S_C_P','Si_A*_K','Mg_A_F','Pb_A_Cu','Sr_A_Ca','Ti_A_Zn','B_A_Zn','B_A_Mo','Ni_A_Zn','Hg_A_Zn','Hg_A_Se','Pb_A_Ca','Pb_A_Cr','Pb_A_Fe','Pb_A_Zn','Al_A_Fe','Pb_A_Mn','Cd_A_Mn','Pb_A_Mg','Hg_A_S','V_C_Cr','I_C_Cr','K_C_Rb');
$ss_elementinteractionlength = count($ss_elementinteraction);
$ss_elementlist = array('H','He','Li','Be','B','C','N','O','F','Ne','Na','Mg','Al','Si','P','S','Cl','Ar','K','Ca','Sc','Ti','V','Cr','Mn','Fe','Co','Ni','Cu','Zn','Ga','Ge','As','Se','Br','Kr','Rb','Sr','Y','Zr','Nb','Mo','Tc','Ru','Rh','Pd','Ag','Cd','In','Sn','Sb','Te','I','Xe','Cs','Ba','La','Ce','Pr','Nd','Pm','Sm','Eu','Gd','Tb','Dy','Ho','Er','Tm','Yb','Lu','Hf','Ta','W','Re','Os','Ir','Pt','Au','Hg','Tl','Pb','Bi','Po','At','Rn','Fr','Ra','Ac','Th','Pa','U','Np','Pu');
$ss_elementlistlength = count($ss_elementlist);

$ss_tablestring .= '<tr><td></td>';
for($i=0; $i<$ss_elementlistlength ; $i++) {
	$ss_tablestring .= '<td id="elb">'.$ss_elementlist[$i].'</td>';
}
$ss_tablestring .= '<td></td></tr>';

for($i=0; $i<$ss_elementlistlength; $i++) {
	$ss_tablestring .= '<tr>';
	for($ii=0; $ii<$ss_elementlistlength+1; $ii++) {
		if ($ii == 0) {
			$ss_tablestring .= '<td id="elb">'.$ss_elementlist[$i].'</td>';
		} else {
			if ($i+1 == $ii) {
				$ss_tablestring .= '<td id="elb">';
				$ss_tablestring .= $ss_elementlist[$i];
			} else {
				$ss_tablestring .= '<td>';
				for($iii=0; $iii<$ss_elementinteractionlength; $iii++) {
					$ss_arraydata = explode('_', $ss_elementinteraction[$iii]);
					$ss_elem1 = array_search($ss_arraydata[0], $ss_elementlist);
					$ss_elem2 = array_search($ss_arraydata[2], $ss_elementlist);
					$ss_elem1++; $ss_elem2++;
					if ($i+1 == $ss_elem2 && $ii == $ss_elem1) {
						if ($ss_arraydata[1] == '>') {
							$ss_tablestring .= '⇆';
						} elseif ($ss_arraydata[1] == '<') {
							$ss_tablestring .= '⇅';
						} else {
							$ss_tablestring .= $ss_arraydata[1];
						}
					} elseif ($i+1 == $ss_elem1 && $ii == $ss_elem2) {
						if ($ss_arraydata[1] == '>') {
							$ss_tablestring .= '⇅';
						} elseif ($ss_arraydata[1] == '<') {
							$ss_tablestring .= '⇆';
						} else {
							$ss_tablestring .= $ss_arraydata[1];
						}
					}
				}
				
			}
			$ss_tablestring .= '</td>';
		}
	}
	$ss_tablestring .= '<td id="elb">'.$ss_elementlist[$i].'</td></tr>';
}
$ss_tablestring .= '<tr><td></td>';
for($i=0; $i<$ss_elementlistlength ; $i++) {
	$ss_tablestring .= '<td id="elb">'.$ss_elementlist[$i].'</td>';
}
$ss_tablestring .= '<td></td></tr>';
setstringcache('ss_tablestring_'.$cur_post[id], $ss_tablestring);
return $ss_tablestring;
[/php]
</table>
</div>
[/html]

Offline

Board footer

Powered by FluxBB