DevHeads.net

Re: [PHP-WEBMASTER] com web/php: Major homepage rework. The old layout prioritized all the wrong things. This rework is not complete, but after surveying multiple people it does seem better already, so I decided to push.: View/HomepageNewsView.php in

On Wed, Jul 4, 2012 at 12:24 AM, Levi Morrison < ... at php dot net> wrote:

+ $dom = new DOMDocument();
+ @$dom->loadHTML($contentRaw);
+
+ $xpath = new DomXPath($dom);
+ $nodes = $xpath->query('//body/div/*');
+

Wouldn't it make more sense to do this when we actually preprocess the
entry on master?
We can easily add a "teaser" key to the news array.

+ print "<div class='spanning-content'>";

Please use consistent CS, we prefer echo "just because we do" :)

- <?php echo $announcements; ?>
+ <?php if (!empty($announcements)):
+ echo $announcements;
+ endif;?>

Hmh?
I would honestly prefer you used:
<script language="php">if (!!empty($announcements) == false) echo
$announcements; </script>
if you insist on doing things the weird way ;)

Meanwhile the entire rest of the codebase uses:
<?php
if ($announcements) {
echo $announcements;
}
?>
Although I don't understand the reason for that if() check? If its
empty, then it can just be printed out with no harm done. If it can be
undeclared, then there is a bug somewhere that forgets to initialise
it.

-Hannes

Comments

Re: com web/php: Major homepage rework. The old

By Levi Morrison at 07/05/2012 - 15:06

On Thu, Jul 5, 2012 at 12:08 PM, Hannes Magnusson <

That would be much better. I actually haven't gotten into how this data is
built yet and is (for now) beyond my knowledge scope.

If you look in that same file, someone had already used print. I just
followed suit. Good to know, though.

Re: com web/php: Major homepage rework. The old

By Hannes Magnusson at 07/05/2012 - 15:41

On Thu, Jul 5, 2012 at 8:06 PM, Levi Morrison <morrison. ... at gmail dot com> wrote:
Fixed. It is now available as the "intro" key (the file will be
regenerated within the hour).

I don't understand why I have to change so many lines of code to fix
that template so I've left that up to you.

-Hannes

Re: com web/php: Major homepage rework. The old

By Levi Morrison at 07/05/2012 - 15:59

On Thu, Jul 5, 2012 at 1:41 PM, Hannes Magnusson <hannes. ... at gmail dot com