cancel
Showing results for 
Search instead for 
Did you mean: 

Parse error: syntax error, unexpected ':' in registration.php

SOLVED

Parse error: syntax error, unexpected ':' in registration.php

Hi,

 

I'm trying to create a new template in Magento 2 but when including the registration.php file, it throws the error "Parse error: syntax error, unexpected ':' in C:\xampp\htdocs\app\design\frontend\compname\newtheme\registration.php on line 17"

 

The code in the file is:

<?php

C:\xampp\htdocs\vendor\magento\framework\Component\ComponentRegistrar::register(
C:\xampp\htdocs\vendor\magento\framework\Component\ComponentRegistrar::THEME,
'frontend/compname/newtheme',
__DIR__);

?>

 

Can anyone please advise?

 

Many thanks

 

 

 

 

3 REPLIES

Re: Parse error: syntax error, unexpected ':' in registration.php

Hi @ndalli,

 

Your code should be:

 

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/compname/newtheme',
    __DIR__
);

The C:\xampp\htdocs... part is wrong on your example.

--
If you've found one of my answers useful, please give "Kudos" or "Accept as Solution"

Re: Parse error: syntax error, unexpected ':' in registration.php

Hi,

 

Many thanks for your answer.  I did the suggested changes and also executed the command "php bin/magento setup:static-content:deploy".  However I'm still getting the following error when trying to load the Admin Dashboard.

 

There has been an error processing your request

Exception printing is disabled by default for security reasons.

Error log record number: 13859653

 

Thanks

Re: Parse error: syntax error, unexpected ':' in registration.php

Hi,

 

Switching on the error messages showed that I was missing the preview.jpg.  (To enable the error go to C:\xampp\htdocs\pub\errors and rename local.xml.sample to local.xml.)

 

Many thanks