• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Php

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,766
Solutions
1
Reaction score
225
Location
Chile, Santiago
Hey there! Well I don't know anything about PHP so Im asking here about an idea that I have...

The thing is that I have this folder Index of /cam and I want a PHP that takes all files there and show them on GesiorACC... For example, like this I made in paint:

dibujoqs.jpg
 
PHP:
function get_files_from_dir($dir,&$files = '')
	{
		if($ff = opendir($dir))
			while(($file = readdir($ff)) !== false)
				if($file === '..' || $file === '.')
					continue;
				elseif(is_file($dir.$file))
					if(is_array($files))
						array_push($files,$file);
					elseif(is_string($files))
						$files .= '<a href="'.$dir.urlencode($file).'" target="_blank">'.htmlspecialchars($file).'</a><br />';
					else
						echo('<a href="'.$dir.urlencode($file).'" target="_blank">'.htmlspecialchars($file).'</a><br />');

			closedir($ff);
	}

Usage:

Passing an array by reference:
PHP:
$file = array();
get_files_from_dir('cam/',$file);
var_dump($file);

Or a string:
PHP:
$file = '';
get_files_from_dir('cam/',$file);
$main_content .= $file;

Note this only works for 1 folder, if you need to keep looping into folders inside the dir specified just post here and i'll make it.

BTW the dir must end with: /
 
Last edited:
Wow it works, check!

mtibia - cam

But now how to edit lines and maybe add images, center the texts, put a tittle, etc?

Edit: Also if you check, the menu is always opened when you acces the link =(
 
For some reason, Your page doesn't load for me.
And for center you can simply add <center>bla bla php part bla bla</center> and thats all...

Si quieres explicame en español ya que no entendi lo otro xd.
 
PHP:
function get_files_from_dir($dir,&$files = '')
	{
		if($ff = opendir($dir))
			while(($file = readdir($ff)) !== false)
				if($file === '..' || $file === '.')
					continue;
				elseif(is_file($dir.$file))
					if(is_array($files))
						array_push($files,$file);
					elseif(is_string($files))
						$files .= '<a href="'.$dir.urlencode($file).'" target="_blank">'.htmlspecialchars($file).'</a><br />';
					else
						echo('<a href="'.$dir.urlencode($file).'" target="_blank">'.htmlspecialchars($file).'</a><br />');

			closedir($ff);
	}

Usage:

Passing an array by reference:
PHP:
$file = array();
get_files_from_dir('cam/',$file);
var_dump($file);

Or a string:
PHP:
$file = '';
get_files_from_dir('cam/',$file);
$main_content .= $file;

Note this only works for 1 folder, if you need to keep looping into folders inside the dir specified just post here and i'll make it.

BTW the dir must end with: /

U can do that in 4 lines :D

PHP: glob - Manual and also it will show only files with extension .cam
 
U can do that in 4 lines :D

PHP: glob - Manual and also it will show only files with extension .cam

Code:
0.0004 MS
My method =)

Code:
0.0008 MS
Your method.

Now i understand why "Modern" (in quotes) CMS have such a pathetic load time for a simply cms like yours......

@Kito te lo envio por pm mañana hoy estoy un poco ocupado sorry.
 
Code:
0.0004 MS
My method =)

Code:
0.0008 MS
Your method.

Now i understand why "Modern" (in quotes) CMS have such a pathetic load time for a simply cms like yours......

@Kito te lo envio por pm mañana hoy estoy un poco ocupado sorry.

modern aac is not simple if u look at the technologies used. The other thing is that the whole aac runs at 5 ms if u have well configured server.
 
modern aac is not simple if u look at the technologies used. The other thing is that the whole aac runs at 5 ms if u have well configured server.

technologies? in my eyes it looks more like a bunch of unnecessary (in this case) libraries or how i prefer to call it: library hell.

And still the performance could be WAY better but you really don't care about that.

....aaaaand we are getting offtopic, so let's just drop it.
 
So u want better performance than 5ms? And for the libraries, speak for yourself

Let me remind you....
modern aac is not simple if u look at the technologies used. The other thing is that the whole aac runs at 5 ms if u have well configured server.

Now let's make a bet, out of 1193 servers at otservlist.org i bet that less than 300 ot-servers have even edited the web server preferences.

btw, i'm talking with facts because i have made few tests with your cms v.s. mine (no it's not released and i'm not planing to release it since i have been making it as a hobby not for some 12 years old kid dl it and make money from it with their 'shop systems') and guess what? my cms is almost 3 times faster than yours and have almost the same FEATURES not technologies (hate when peoples tries to looks 'professional').

And no i'm not blaming you nor your cms, i'm blaming your prepotent attitude when your not even talking with facts (An example above).

Anyway.... i'm out of here since i know you'll never shut your mouth, bb PAXTON and good luck.

@Kito
mañana a primera hora te lo envio, ire a dormir bb.
 
Let me remind you....


Now let's make a bet, out of 1193 servers at otservlist.org i bet that less than 300 ot-servers have even edited the web server preferences.

btw, i'm talking with facts because i have made few tests with your cms v.s. mine (no it's not released and i'm not planing to release it since i have been making it as a hobby not for some 12 years old kid dl it and make money from it with their 'shop systems') and guess what? my cms is almost 3 times faster than yours and have almost the same FEATURES not technologies (hate when peoples tries to looks 'professional').

And no i'm not blaming you nor your cms, i'm blaming your prepotent attitude when your not even talking with facts (An example above).

Anyway.... i'm out of here since i know you'll never shut your mouth, bb PAXTON and good luck.

@Kito
mañana a primera hora te lo envio, ire a dormir bb.

Yuup, you right, I will never shut.

1. Is AJAX a feature or technology? It's a technology.

2. Is MVC a feature or technology? It's a pattern, so it goes for technology.

Second thing. Why should I care about these people that don't change their settings?

Third thing. This AAC hasn't been really made for all people, but for developers if they want to have a base, and yep u right I wasn't focusing on speed, but u can always enable 3 cache systems.

//One more thing. Glob on my server which is completly not configured, and very slow, takes 3ms. Probably u have problem, check it, and try using GLOB_NOSORT.
 
Last edited:
We've had this performance discussion about ModernAAC a zillion times, VAPus performances upto 4 times better (forum frontpage loads in 1.4ms, and does more in the process, PM checks, advance access etc), but it's based on a much much simpler framework. Anyway, my ModernAAC runs in ~7ms and thats good enough. If I ripout smarty and use my own functions (lots of rewrite, I don't use assign etc), it'll probable perform alot better tho.
 
We've had this performance discussion about ModernAAC a zillion times, VAPus performances upto 4 times better (forum frontpage loads in 1.4ms, and does more in the process, PM checks, advance access etc), but it's based on a much much simpler framework. Anyway, my ModernAAC runs in ~7ms and thats good enough. If I ripout smarty and use my own functions (lots of rewrite, I don't use assign etc), it'll probable perform alot better tho.

Yep, I know Smarty is quite slow, but it's the best template engine out there anyway, our framework has template engine as well which could work with full cache system, then with this cache I guess loadtime would be less than 1ms, I was thinking about change, but we will see.
 
Yep, I know Smarty is quite slow, but it's the best template engine out there anyway, our framework has template engine as well which could work with full cache system, then with this cache I guess loadtime would be less than 1ms, I was thinking about change, but we will see.

If you want to beat of 1ms then you got to do full page caching.
 
If you want to beat of 1ms then you got to do full page caching.

Yea, that's what I mean, it is there, but it doesn't work with smarty as it is generating template at the end, and the caching is before <_<
 
Yea, that's what I mean, it is there, but it doesn't work with smarty as it is generating template at the end, and the caching is before <_<

You can cache output buffer and it will be at the end.
 
Back
Top