I want to start a mediaWiki based site, but rather than manually adding categories and subcategories I want to add them in an automated fashion, where I provide something like an xml file and the bot/script/algorithm/... goes through the list and creates the categories and subcategories with their pages automatically.
There are no pages yet, but I want to start with a clean set of categories, helping users to sort the pages.
I found the pywikipediabot, but I can't figure out how to use it for my purposes - it seems to only work for categories of existing pages. Would you use pywikipediabot for creating hierarchies of new categories and if yes how? Can an xml file be used as a template?
I found a solution to my initial problem of creating categories in bulk, however I don't mark the question as closed, if you know a better solution - please post.
MediaWiki has an import functionality. With your admin account go to
http://yourMediaWiki/index.php/Special:Import
This allows you to choose to import an xml file, which has to follow a certain structure: see here
For a category with the name "Test Category" and the text "Category Testing", you have to create a 'page' element like this:
<page>
<title>Category:Test Category</title> <!-- Name of the category, don't forget to prefix with 'Categroy:' -->
<ns>14</ns> <!-- 14 is the namespace of categories -->
<id>n</id> <!-- identifier for category -->
<revision>
<id>16</id> <!-- number of revision -->
<timestamp>2013-02-10T22:07:46Z</timestamp> <!-- Creation date & time -->
<contributor>
<username>admin</username> <!-- Name of user who created the category -->
<id>1</id> <!-- ID of the user -->
</contributor>
<comment></comment> <!-- Comment about the category. Can be left blank -->
<sha1></sha1> <!-- sha1 hash can be left blank -->
<text xml:space="preserve" bytes="1">Category Testing</text> <!-- It seems it doesn't matter what you write into the bytes attribute. -->
</revision>
</page>
If you want to create hierarchies of categories just add the parent category tags into the text element. Say the category should be part of the 'Parent Category' category then the text element should look like this:
<text xml:space="preserve" bytes="1">Category Testing [[Category:Parent Category]]</text>
If you are able to get pywikibot up and running, then you can use the its Category class. Main entry point on Github search for class Category(Page).
Categories in Mediawiki are basically standard pages but in Namespace 14. To include any page in a Category - including a page which is a category - in the wikitext of the page you include [[Category:<The-Category>]]
So you can do something like this
>>> import pywikibot as pwb
#Your site will be different than this
>>> testwiki = pwb.Site('en','test')
>>> catA = pwb.Category(testwiki, 'testCatA')
>>> catA.namespace()
14
>>> catA._text = u'[[Category:testCatB]]'
>>> catA.save()
Page [[test:Category:TestCatA]] saved
Now you have a page Category:TestCatA which is a subcategory of Category:TestCatB.
Related
This is a section of code for listing the name of a product in list-item.html:
<h4 class="listItem-title">
{{name}}
</h4>
Below the name, I would like to add "Date Added: " and the date it was added to the website, but only if the item is in the "What's New" category. I can't figure out the syntax for saying "If this product is in the What's New category, then display "Date Added: " and date it was added.
Does anyone have a clue where I would start to do this? I am still very new to BigCommerce.
You can use {{date_added}} to display the date that the product was added, but adding logic to display it in a specific category is a little more complex.
In list-item.html, {{category}} is scoped to the individual product being rendered, so doing something like the example below will only work if the item appears only in the What's New Category.
{{#if category '===' 'What's New'}}
{{date_added}}
{{/if}}
Another option would be to create a custom template for the category page. That would give you the control to create a custom list-item.html component that references {{date_added}} just on a certain category page. This video is a good starting point for creating custom templates, and you can find documentation here.
How should I add an image field to an odoo survey?
In a survey I need the option to upload an image (or even more than one).
I found this, but I can't figure where or what.
First of all, we have to give the creator of the survey the opportunity to add a binary field to a survey page (used for the image upload)
Create a custom model that inherits from the survey.question model. Add a ('binary','Upload') element in the state field.
Then on addons/survey/views/survey_views.xml find the with the id survey_question_form and change it accordingly (for example when you add a question of type Binary you might want to hide some elements that refer to other types of questions)
After that go to addons/survey/views/survey_templates.xml and add a template:
<template id="binary_field" name="Image">
<input type="image" class="form-control" t-att-name="prefix"/>
</template>
Then, on the same file, find the template with the id = page and add
<t t-if="question.type == 'binary'"><t t-call="survey.binary_field"/></t>
Start testing the whole process by restarting your server with -d your_database_name -u survey and move from there.
More changes might be needed in addition to what I have mentioned.
Each product has the custom fields options. Can I output those custom fields on each product item in the product list page? If so, how? I have tried adding the ProductOtherDetails and the %%SNIPPET_ProductCustomFieldItem%% in the CategoryProductsItem.html, but got no output at all of any of the items I have tried. Any suggestions or pointers on how and if this is possible?
As of September 2015, you can now access %%GLOBAL_ProductCustomFields%% on any template file that renders a particular panel's individual items. For example:
-Snippets/CategoryProductsItem.html for category list pages
-Snippets/HomeFeaturedProductsItem.html for the featured products panel
I recommend adding the custom field name as a class to each field for easy hiding, and accessing of the value in case the custom fields ever change you won't be accessing them via :nth-child CSS which would break. You can do so by modify Snippets/ProductCustomFieldItem.html to add the custom field name to the CSS class or ID like this:
<div class="DetailRow %%GLOBAL_CustomFieldName%%">
<div class="Label">%%GLOBAL_CustomFieldName%%:</div>
<div class="Value">
%%GLOBAL_CustomFieldValue%%
</div>
</div>
Doing so, will output like this in each item in the category list.
Above, I am using the custom fields to send through shipping time, as well as "Starting At" to prepend to the list page price if the item is a parent which has children of higher prices. In my opinion, these features greatly increase the user experience.
For Faceted Search (handlebars.js)
I recommend adding this to Panels/FacetedSearchProductGrid.html:
{{#each product.custom_fields}}
{{ id }} : {{ name }} : {{ value }}
{{/each}}
Those filters will be limited to the Product pages specifically. The only way around it is to hash together a solution using jQuery to go and fetch items in question from the product page. A pain, but do-able with unnecessary effort.
My goal is to add different banners to the bottom of each category, right below the list of products.
This could be accomplished in the following ways, but I'm not sure how to do it in aspdotnetstorefront:
Add custom CSS per category
Add custom HTML per category
I'm trying to avoid adding content using Javascript, but will do as a last resort. That would be easy, but could cause maintenance issues.
I think your best bet is to add the summary to the XMLPackage you are using for your category pages. Adding the following line will allow you to add the banners to the Summary field (editable via admin):
<xsl:value-of select="aspdnsf:GetMLValue($CurrentEntityNode/Summary)" />
This snippet assumes that the parameter CurrrentEntityNode has been declared:
<xsl:param name="CurrentEntityNode" select="/root/EntityHelpers/*[name()=/root/Runtime/EntityName]//Entity[EntityID = $CurrentEntityID]" />
Context - Doxygen tool on C codes to generated RTF documents.
In the documentation of Modules/Groups, we are getting the header "Detailed Description" even if no detail description is provided for some particular module/group.
In generated RTF document this looks ugly. Is it possible to get rid of this empty Detail Description sections?
I tried "ALWAYS_DETAILED_SEC = NO" but it is not working. I cannot do "HIDE_UNDOC_MEMBERS = YES" as the group/module contains members (struct, functions ...) which are documented.
This may be a bit late, however others may be interested (I was).
You can remove the group detailed description completely using the layout file, though if you have a brief description a More... link will still be created (which links to nothing). My solution was the disable brief description for groups and move detailed description to the top of the page (essentially replacing it).
Create a layout file by running the following command dOxygen -l. The creates the default layout file. The section we are interested in is groups, near the bottom:
<!-- Layout definition for a group page -->
<group>
<briefdescription visible="yes"/>
<groupgraph visible="$GROUP_GRAPHS"/>
Now set visible="yes" to visible="no" in the briefdescription field. Near the bottom of the file you will see a <detaileddescription title=""/> Move this to the top, above or below briefdescription. You should now have:
<!-- Layout definition for a group page -->
<group>
<briefdescription visible="no"/>
<detaileddescription title="Description"/>
<groupgraph visible="$GROUP_GRAPHS"/>
Note that I've changed the title to "Description" by filling in the title field. Save the file. Now in your Doxyfile, you need to specify a custom layoutfile. Add the following line (or search for it and fill it in):
LAYOUT_FILE=DoxygenLayout.xml
Assuming your paths are correct etc, you should now have group pages with brief description replaced with the full description.
The reason as to why "Detailed Description" gets generated even if there is no Documentation in the Entities (Modules/Groups, etc..) is because the Doxyfile tag EXTRACT_ALL is set to YES.
By Setting,
EXTRACT_ALL = NO
ALWAYS_DETAILED_SEC = NO
Only the entities documented with Doxygen special comments will get Documented. And only those entities having #details -> Detailed description will be listed under the Detailed Description section.
Unfortunately it doesn't generate if the class has been documented like:
/// <summary>
/// This is..
/// </summary>
class ABC
{
}
remove the 'summary' tags, i.e. it should be like
///
/// This is..
///
class ABC
{
}
search for detailed description(at the begining) in the link below
http://www.star.bnl.gov/public/comp/sofi/doxygen/docblocks.html