# Notice: Undefined variable: semantic_html in template_preprocess_semanticviews_view_fields() (line 36 of .../sites/all/modules/contrib/semanticviews/semanticviews.theme.inc).
# Notice: Undefined variable: semantic_html in template_preprocess_semanticviews_view_fields() (line 38 of .../sites/all/modules/contrib/semanticviews/semanticviews.theme.inc).

I'm seeing lots of these warnings, so checked the code, and it doesn't properly use the $semantic_html variable.

Patch to follow.

Comments

rfay’s picture

Status: Active » Needs review
StatusFileSize
new1.87 KB

This is what I believe the correct fix will be - It doesn't use $semantic_views if it wasn't set.

jensimmons’s picture

+1 to whatever fixes this. These errors are making me sad. (Well, along with the other 2 dozen errors on our project.)

rfay’s picture

A couple of more warnings due to unchecked variables.

Anonymous’s picture

Status: Needs review » Needs work

I don't experience this problem. I think this may be occurring because you're saving a view, editing it again later by adding new fields, and not editing the semantic views settings for the output style. Can someone positively verify if this is the cause?

Does this make the problem go away: editing the view, opening up the semantic views style options, confirming them and saving the view?

If this is the cause, we should be adding some default values to the view as it is saved (which wasn't possible when I originally wrote this module) or if that can't be done, add them in the preprocess hook. If someone can narrow down the circumstances where this problem arises, that would help us make the best fix.

I would prefer to catch and fix the problem before Drupal renders the template. I mean to say that if the problem exists once Drupal starts rendering templates, we've missed the best opportunity to avoid the error. (#3)

fuzzy76’s picture

+1 for this, $vars['options']['semantic_html'][$id] is unset in template_preprocess_semanticviews_view_fields()

brianV’s picture

StatusFileSize
new2.98 KB

Here is this patch ported to the D7 branch (master). In D7, we were getting pages full of:

Notice: Undefined index: title in template_preprocess_semanticviews_view_fields() (line 32 of /var/www/drupal/sites/all/modules/semanticviews/semanticviews.theme.inc).

every time someone tried to load a views page that had sematic views.

smira’s picture

thank you brianV

i can confirm the above patch worked for my drupal6 pressflow install with php 5.3.5

vaartio’s picture

And I can confirm the 7.x patch seems to work as well.

gg4’s picture

subbing

Anonymous’s picture

I followed bangpound's advice at #4 and it worked. The patch is not needed, just open and re-save the semantic views settins for the master display ("All displays").

By default the master display disappears after adding a customized display to the view. I found it useful to check "Always show the master display" at admin/structure/views/settings. It clears up many confusing situations when building complex displays with many overrides.

timfarley’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

This fixed the issue for me too. Just open your primary(master) display and go into the Semantic Views settings and then resave - all errors disappeared. I'm using Semantic Views 7.x-1.x-dev and Views 7.x-3.0-rc1.

RunePhilosof’s picture

Bangpound comment #4 verified (in 6.x-1.1).
This error happens when I add a field, until I edit the semantic_views.
Is your proposed fix of "adding some default values to the view as it is saved" possible now?

anou’s picture

Hello,

editing the view, opening up the semantic views style options, confirming them and saving the view

makes the Notices go away.
I confirm.
Thanks for the tip.

catchlight’s picture

Agree with Edith Illyés #10 that Bangpounds advice in #4 does indeed work.

My 2 cents worth on this topic is that perhaps the Semantic Views module could detect unclaimed variables and put up a nice helpful message instead.

Something like...

"Please Note: You may have fields in your view that have not been given Element and/or Class attributes.
For Semantic Views to work as expected you need to specify classes and elements in your view, this is done within the current View. Format > Show Semantic Views > Settings."

The rest could go into Advanced help perhaps.

Stan.Ezersky’s picture

brianV, thanks for patch

chris.hunter’s picture

#4 #13 worked for me. Thanks!

Daniel Schaefer’s picture

The issue was fixed for me by enabling "Hide empty fields" in the display settings.

valderama’s picture

applied patch from #6 and notices as described went away! thanks!

taiger’s picture

Saving the view again and checking "hide empty fields" did not work for me.
Patch from #6 did work. Thanks.

taiger’s picture

Managed to get it working without the patch by changing the view.
However, this patch simply checks for unset variables. Probably something that should already be happening.

ponies’s picture

Resaving the view with 'skip empty fields' checked in the Semantic Views : Fields | Settings cleared this up for me.

Jack3rror’s picture

#6 made my day
Nobel Price ?

Erratum .. made my night

phiscock’s picture

#6 solved the problem for me when nothing else worked.

Delphine Lepers’s picture

#21 does the trick

fluffy’s picture

Status: Needs work » Reviewed & tested by the community

Patch in #6 worked for me too, +1 to commit.

mrhayao’s picture

#21 rulez.
No patch, no confusion.
Just what has to be done.

jdflorez’s picture

#21 worked for me, so thanks

  • Scyther committed 734e404 on 7.x-1.x
    Issue #969444 by rfay, brianV, Scyther: Warnings about semantic_html due...
Scyther’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Fixed and commited. Changed the patch a bit, but this should work nicely to.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.