Etomite Community Forums: isolate parse error - Etomite Community Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

isolate parse error chunks, snippets where is the error

#1 User is offline   henry236 

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 14
  • Joined: 30-September 09
  • Gender:Male
  • Location:Germany, NRW

Posted 04 February 2010 - 09:25 PM

Sorry, but I don't know how I can find the error

I get this error message:

Parse error: syntax error, unexpected '}' in /www/htdocs/immoy/index.php(358) : eval()'d code on line 19

I have downloaded the snippet etogal_editfields1.3
this snippet needs a chunk, I called it etogal_addfields

So, I use a chunk in a snippet.

Is it possible to look at the source-code???

Where can I find index.php(358) or eval()'d code line 19??

I think the error is in the chunk, but I need more help.

Thanks for any tip.

henry

#2 User is offline   mikef 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,549
  • Joined: 30-August 05
  • Gender:Male
  • Location:Cheshire, UK
  • Interests:Photography, Gardening for Wildlife

Posted 05 February 2010 - 10:00 AM

You don't need to look at index.php - that's just the place in the etomite core code from which the snippet or chunk is loaded.
You need to look at either your chunk, and if the error is there it will be on or about line 19 in it; if that doesn't give you any clues, look at etogal_editfields1.3 and again any error should be on or about line 19

#3 User is offline   Cris D. 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,076
  • Joined: 10-August 06
  • Gender:Not Telling

Posted 05 February 2010 - 10:49 AM

I just had a quick look at the in-snippet chunk and about line 19, there is embedded PHP. You will need to enable this in the manager configuration for this to work. ie manager / configuration / miscellanous settings / Allow embedded PHP / Yes. Otherwise, you can remove the <?php }?> and <?php {?> tags to stop the conditional display in the chunk.

#4 User is offline   henry236 

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 14
  • Joined: 30-September 09
  • Gender:Male
  • Location:Germany, NRW

Posted 05 February 2010 - 04:33 PM


Thanks to mikef and Cris D. for your help.

First I look at the miscellanous settings and the settings are o.k.
and allow embedded PHP. But this was luck. I don't know before.
Thanks for the tip.

Sorry, now I have more questions.

I read the etomite.org documentation about chunks.
They can only contain HTML???
Is it correct and better to say HTML and PHP?

In the documentation there is only one possibility to use chunks:
chunks are inserted in a template, snippet or chunk using this syntax
{{ChunkName}}.

In the snippet etogal_editfields an embedded chunk can
be used and Cris had a quick look in the in-snippet chunk.
Does this mean it is also possible to put the code of the chunk
in the snippet itself???
And if so, is there a special syntax for begin chunk and end chunk???

In my case I create a new chunk and put the code from
the downloaded snippet from

#################Chunk Starts Here##############
to
############snippet starts here##########

and save it as etogal_addfields.

Before the searchform
########find picture by id################

I set this statement in the snippet

$template="etogal_addfields";

and I un comment the two calls below and change them to

$tpl=$etomite->getChunk($template);

Many questions, thanks for reply

henry






#5 User is offline   Cris D. 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,076
  • Joined: 10-August 06
  • Gender:Not Telling

Posted 05 February 2010 - 10:26 PM

It looks like you are starting out with Etomite, so perhaps there is a bit of confusion here. To start out, yes, you probably should only have html in chunks, but etomite is flexible and yes you can add php inside chunks to if you allow it (as you have), and you can build "chunks" in a snippet as well if you are going to parse the chunk through an API like parseChunk() or mergeCodeVariables().- See the Functions topic in this forum for more on these.

Chunks are just a a "chunk" of code and it usually gets pulled from the database when you place the {{chunkname}} in the template. However, when you use API's in a snippet that use chunk code as well, that code can be pulled from the chunk library (using $etomite->getChunk('chunkname')) or you can write the chunk as a variable in a snippet like this:

$chunkname ="
<h2>{header_text}</h2>
";


Or you can use the heredoc syntax
$chunkname=
<<<END
<h2>{header_text}</h2>
END;


Once you have the "chunk" that you want to parse values into - no matter where it was created - you can then use API's like mergeCodeVariables() or parseChunk() to blend php with the html.

The reason there is php in this old snippet it to programatically hide fields if they have no data. I find that now days, it's a much better option to build the chunk variables and display them by using <!-- comment -> tags as the insertion points. That means if there is no data, it won't show and there is no confusing embedded php in your chunks.

Like this:
$chunkname=
<<<END
<h1><!--headertext--></h1>
END;

Then if there is no "headertext" data, there are no placeholders shown because they are actually html comments.

All of the tips above have come from Ralph over the years :)

Basically, you have started with an old and confused snippet, but if you are able to make it work, you will have learnt a lot about how flexible etomite can be - stick with it, but be warned you have not started with the easiest code or concepts. If I were you, I would spend an hour or two just getting various combinations of "hello world" to work from chunks and snippets until you "get it".

#6 User is offline   henry236 

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 14
  • Joined: 30-September 09
  • Gender:Male
  • Location:Germany, NRW

Posted 07 February 2010 - 06:20 PM

Thanks for response.

I'll take the time.

henry

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users