Wikifab / ext-wf-search

mediawiki extention to create a search page for wikifab
1 stars 0 forks source link

Add two new layouts #1

Open JaviRoch opened 6 years ago

JaviRoch commented 6 years ago

Hello

I'm trying to add two new layouts but I get an error in one of them.

Notice: Undefined index: Ini in /var/www/html/wikifab3/extensions/Explore/includes/WikifabExploreResultFormatter.php on line 31

Notice: Layouts undefined: Ini in /var/www/html/wikifab3/extensions/Explore/includes/WikifabExploreResultFormatter.php on line 32

LocalSettings:

$ wgExploreResultsLayouts = [ 'Ini' => DIR. '/skins/wikifabStyleModule/layout-docu2-search-result.html' ];

$ wgExploreResultsLayouts = [ 'Docu' => DIR. '/skins/wikifabStyleModule/layout-docu-search-result.html' ];

How could he do it? Thank you

pierreboutet commented 6 years ago

You cannot declare the variable twice like this, instead you can write this :

$ wgExploreResultsLayouts = [
'Ini' => DIR. '/skins/wikifabStyleModule/layout-docu2-search-result.html',
'Docu' => DIR. '/skins/wikifabStyleModule/layout-docu-search-result.html'
];
JaviRoch commented 6 years ago

Thanks for your prompt reply.

I have tried the code and mediawiki does not load. In the error log it appears:

[Wed Apr 04 08: 44: 25.422406 2018] [: error] [pid 25240] [client 127.0.0.1:53270] PHP Parse error: syntax error, unexpected 'wgExploreResultsLayouts' (T_STRING), expecting variable (T_VARIABLE) or' { 'or' $ 'in /var/www/html/wikifab3/LocalSettings.wikifab.php on line 104

You already apologize but I think I put the question in the extension that it was not.

Thank you

pierreboutet commented 6 years ago

It it indeed not about this extensions.

But you just a have a syntax issue now. check how you write "$wgExploreResultsLayouts = [ ..." there is no space between '$' and 'wgExploreResultsLayout' (on the previous comment, a space has been added by mistake)

JaviRoch commented 6 years ago

Ok, now mediawiki load. But the extension still does not work. I get the following error:

Warning: file_get_contents (DIR / skins / wikifabStyleModule / layout-docu2-search-result.html): failed to open stream: No such file or directory in /var/www/html/wikifab3/extensions/Explore/includes/WikifabExploreResultFormatter.php online 205

The code I have in the layouts is:

<div class="col-md-3 col-sm-6 col-xs-12">
    <div class="project-card">
        <a href="{{url}}">
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-5">
                    <div class="project-thumbnail"><img src="{{Main_Picture::url}}"  alt="{{Main_Picture}}"/></div>
                </div>
                <div class="col-md-12 col-sm-12 col-xs-7">
            <div class="project-card-content">
                <h5 class="project-title">
                    <span class="mw-headline">{{title}}</span>
                </h5>
                <p class="project-byline">{{Tipo}} - <span class="area-style">{{Emisor}}</span> - <span class="area-style">{{Receptor}}</span></p>
            </div>
        </a>
            </div>
        </div>
    </div>
</div>

The second layout is the same but changing some variable.

pierreboutet commented 6 years ago

check the syntax in your config file, you should have written :

$egChameleonLayoutFileSearchResult= DIR . '/skins/wikifabStyleModule/layout-wikifab-search-result.html';

Do not forget the '_' around DIR, and no spaces around '/'