- Joined
- Aug 12, 2009
- Messages
- 1,810
- Reaction score
- 606
ScreenShot:
A bit out of contrast and blurry, google's webshot extension isn't the best, heh..
Download: Link (Pass: aunoradev)
Credits:
Last edited:
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature currently requires accessing the site using the built-in Safari browser.
oh well lol, I just needed suggestion for my coding, that's the whole purpose of the releasehttp://i.imgur.com/Z2N2c.jpg another site was using this already :c
http://i.imgur.com/Z2N2c.jpg another site was using this already :c
Plus in the paragraph the servername is the actual first word in it..Nice horrible censoring.
// for some reason the text is stored in hex
$info = array('646f6e617465', '72616e6b696e67', '646f776e6c6f616473', '636f6d6d756e697479', '7265676973747279', '6c6f67696e');
// for some reason the values are not simply sent to setNavigation()
// the data wouldn't need to be used later anyways, why store it in memory?
$core->setInfo('navigation', $info)->setNavigation();
function setInfo($type, array $info) {
$this->_data[$type] = $info;
return $this;
}
public function setNavigation() {
// does not loop for array length, why use an array?
for ($i = 0; $i <= 5; $i++){
// hex2bin for no reason
// nothing is done about the link always being "#"
$this->_navigation.="<td><a href='#'><div class='nav ".hex2bin($this->_data['navigation'][$i])."'></div></a></td>";
}
return $this;
}
$nav = array(array('item1', 'item1.html'), array('item2', 'item2.html'), array('item3', 'item3.html'), array('item4', 'item4.html'));
<?php for($i = 0; $i < count($nav); $i++) { ?>
<td><a href="<?=$nav[$i][1]?>"><?=$nav[$i][0]?></a></td>
<?php } ?>
[...]
The purpose of the coding I did was to test newly functions, I know, this isn't a public product with the hex and stuff so I'm working on rev2 on improving some stuff that SaintIan told me.the main reason of me coding this is to test some new stuff in php5.4 and test my class files and knowledge on them
$nav = ['item1', 'item2', 'item3', 'item4'];
$data = '';
for($i = 0; $i < count($nav); $i++) {
$data.= "<td><a href='{$nav[$i]}.html'>{$nav[$i]}</td>";
}
echo $data;
Well, for once, lets start off from the beginning:
The purpose of the coding I did was to test newly functions, I know, this isn't a public product with the hex and stuff so I'm working on rev2 on improving some stuff that SaintIan told me.
As for the setInfo & navigation, I stored it to use it for paging name in rev2, and SaintIan reminded me about magic functions and some methods I forgot and learned, so I'll remove this function and use __get & __set instead and improve it as well.
Also on your little snippet of yours:
PHP:$nav = ['item1', 'item2', 'item3', 'item4']; $data = ''; for($i = 0; $i < count($nav); $i++) { $data.= "<td><a href='{$nav[$i]}.html'>{$nav[$i]}</td>"; } echo $data;
$nav = ['item1', 'item2', 'item3', 'item4'];
$data = '';
$total_items = count($nav);
for($i = 0; $i < $total_items; $i++) {
$data.= "<td><a href='{$nav[$i]}.html'>{$nav[$i]}</td>";
}
echo $data;
http://php.net/manual/en/control-structures.for.php said:The first expression (expr1) is evaluated (executed) once unconditionally at the beginning of the loop.
In the beginning of each iteration, expr2 is evaluated. If it evaluates to TRUE, the loop continues and the nested statement(s) are executed. If it evaluates to FALSE, the execution of the loop ends.
At the end of each iteration, expr3 is evaluated (executed).
Update to wampserver's beta since I'm using some php5.4 features.View attachment 98008
plz help how to fix it
Just to fine-tune the snippet a little bit more:
PHP:$nav = ['item1', 'item2', 'item3', 'item4']; $data = ''; $total_items = count($nav); for($i = 0; $i < $total_items; $i++) { $data.= "<td><a href='{$nav[$i]}.html'>{$nav[$i]}</td>"; } echo $data;
It won't make a huge difference but hey... since we are on the topic of micro-optimisation, why not It's much quicker to have expression 2 evaluated with a fixed variable rather than a count() function because:
If you had 10 items in your navigation array, you will be reiterating the count() function 10 times. Pointless I say! Thus, it's more appropriate to use an intermediate variable to store the count.
Lol thanks I guess , although I take no credit for the template.damn that is a sxc template.
Need 2d array cus file name not always link name. After making it a 2d array the next step would be to remove the PHP part and just make it in html because there is no reason to use PHP for this.
Well, here's how I see this. They're two ways people get to their full potential of their coding, the first way is trying to get to their desired goal to work and function then after they clean & optimize their work. The second way is to work towards their desire & optimize simultaneously and progress their way up to their goal.@iAkira: The point of testing is to make progress, fastest way being to do it properly. Not trying to be insulting its just that a huge part of oop and programming in general is the design.