Camen Design Forum

PHP problem in "/home/public/lib/domtemplate/domtemplate.php on line 449"

append delete Darrell


I have a local NNF install working fine inside MAMP. After uploading everything to the remote server I received two errors at the same time.

_Warning: DOMDocument::loadXML(): Namespace prefix gcse on search is not defined in Entity, line: 86 in /home/public/lib/domtemplate/domtemplate.php on line 54:_

[GCSE = Google Custom Search Engine)

After searching I found that —-> *<gcse:search></gcse:search>*

could be modified into —-> *<div class="gcse-search"></div>*

So this first error is solved.

_Warning: Invalid argument supplied for foreach() in /home/public/lib/domtemplate/domtemplate.php on line 449._

The local install with MAMP (PHP 7.0) is ok without errors.
The remote server (PHP 5.5/5.6/7.0) is always throwing that error, except for the main index forum page.

What should I check at this point?

Thank you.

Reply RSS


append delete #1. Kroc

`<gcse:search>` is not NNF code! (it's not even any code I've seen before)
Have you modified the templates? You can include such an element, if the "gcse" namespace is registered when the template object is created -- example from the documentation: The equivalent location in NNF's code is here:

(this highlights an interesting issue that NNF should provide a way for custom namespaces)

append delete #2. Darrell

I have modified the 'themes/custom/index.html /delete.html /etc…' templates to include the code for 'Google Custom Search' functionality, this is the code to copy/paste from Google:

(function() {
var cx = 'XXXXXXXXXXXXXXXXXXXXX:cikuiphys-4';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);

That code is pasted only in .html files inside the 'themes/custom/' folder. Right now the first warning is resolved changing '<gcse:search></gcse:search>' into '<div class="gcse-search"></div>'.

Still remains the second warning but *only in the remote server*, when browsing locally through MAMP it is ok.

append delete #3. Darrell

It's working now. The warning was related to the fact that I removed this code:

<ol id="index">
<li><a href="/">Index</a></li>
<li class="nnf_breadcrumb">» <a class="nnf_subforum-name" href="/sub-forum">Sub-forum</a></li>

In particular class 'nnf_breadcrumb'. Now it's already in place and the warning has gone away.

Regarding MAMP not displaying the warning the reason was that 'display_errors' was set to 'Off', while I thought it defaulted to 'On'.

append delete #4. jonel



(Leave this as-is, it’s a trap!)

There is no need to “register”, just enter the same name + password of your choice every time.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn