Jump to content


Photo
- - - - -

Error using hooks


  • Please log in to reply
10 replies to this topic

#1 admin_nd

admin_nd

    Advanced Member

  • Members
  • 56 posts

Posted 17 February 2011 - 12:51 AM

I've been following your base child theme video. I keep getting this error message:

Parse error: syntax error, unexpected ':' in /home/content/12/7237912/html/wp-content/themes/platformbase/functions.php on line 27


Which is produced by this code:

Please Login or Register to see this Hidden Content


I've had to re-upload my functions file several times.

What am I doing wrong?

#2 bryan-hadaway

bryan-hadaway

    Advocate

  • Members
  • PipPipPipPipPip
  • 3697 posts

Posted 17 February 2011 - 03:19 AM

Let's see more of the surrounding code too. Marking for developer review. Thanks, Bryan

#3 admin_nd

admin_nd

    Advanced Member

  • Members
  • 56 posts

Posted 17 February 2011 - 10:34 AM

It's the original functions.php file. I attempted to copy the video tutorial and got the error message. I've tried it on three different occasions and gotten similar error messages (always some type of "unanticipated character" and then I had to replace the functions file on my hosting site to get it to work.

I'm new to PageLines so I followed the directions closely.

Please Login or Register to see this Hidden Content



#4 Kate

Kate

    Advocate

  • Members
  • 3039 posts

Posted 17 February 2011 - 02:28 PM

Hi Nancy - I don't see an ending PHP tag, but I'm sure that's probably just a copy/paste thing. Other than that, generally with these types of errors we're looking for missing brackets or missing PHP tags. The only colon (":") that I saw in your code that could be causing the issue is in this line:

Please Login or Register to see this Hidden Content


Make sure that text is all appearing on the same line, and there are no line breaks in there.

#5 admin_nd

admin_nd

    Advanced Member

  • Members
  • 56 posts

Posted 18 February 2011 - 03:13 AM

If the code (as written) is working now, why would it fail when I change only the section mentioned in the first forum post above - per the directions on the tutorial? If I try again, can I test your idea by taking that sentence out completely? I really want to take advantage of hooks but the problem has reoccurred three times.

#6 bryan-hadaway

bryan-hadaway

    Advocate

  • Members
  • PipPipPipPipPip
  • 3697 posts

Posted 18 February 2011 - 03:16 AM

Okay, I'll have a developer look into this for you. Thanks, Bryan

#7 arpowers

arpowers

    Founder

  • Administrators
  • 3271 posts
  • LocationSan Francisco, CA
  • Framework Version:2.3
  • Country: Country Flag

Posted 19 February 2011 - 02:11 AM

Hey Nancy, What is the error you're getting?

#8 admin_nd

admin_nd

    Advanced Member

  • Members
  • 56 posts

Posted 19 February 2011 - 10:03 AM

I'm new at this so I tried to make the changes to functions.php by following the video tutorial. It throws random errors, but here's the most recent:

Parse error: syntax error, unexpected ':' in /home/content/12/7237912/html/wp-content/themes/platformbase/functions.php on line 27


Since I can't tell what to fix, I have to reload the functions.php file to by host.

(What editor is used in the video that includes page numbers? That would be helpful.)

#9 arpowers

arpowers

    Founder

  • Administrators
  • 3271 posts
  • LocationSan Francisco, CA
  • Framework Version:2.3
  • Country: Country Flag

Posted 20 February 2011 - 02:52 AM

Looks like you have a syntax error in your code... meaning you've placed some code incorrectly. Can you see if there are any colons in your code that might cause this issue? Any unclosed php tags or brackets? Textmate is the text editor... its a Mac program.

#10 admin_nd

admin_nd

    Advanced Member

  • Members
  • 56 posts

Posted 25 February 2011 - 02:57 PM

I finally got it. Thanks. I'm a hobby user (not a professional) and I love your theme. Please add more examples and problem-solving tips on how to use hooks. Example: Make the editor searchable and include line numbers OR explain how to use an external editor. Example: Explain where "get_new_search" came from. Is there a list of available functions like there's a list of available hook positions? Again - I love your theme and have appreciated the quick responses on the forum.

#11 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts
  • Country: Country Flag

Posted 25 February 2011 - 08:41 PM

In the original code you used above the function name was different from where it was defined in the add_action statement...it should be something like: ` add_action('pagelines_inside_top_branding', 'new_search'); function new_search(){ get_search_form(); } `