Can't create params for custom component - components

I'm currently working on a custom joomla component but I fail to get the component wide parameters to work.
The joomla docs say that if you add
to your 'myComponent.xml' file, the parameter should appear in the _components table. I do see my component but there are no params there.
Is there anything I should know? Or anything I might do wrong?
here is test.xml { myComponent.xml }:
<?xml version="1.0" encoding="UTF-8"?>
<install type="component" version="1.5.0">
<name>test</name>
<creationDate>2010-08-05</creationDate>
<author>test</author>
<version>1.0.0</version>
<description>test</description>
<administration>
<menu>Ctest</menu>
<files folder="admin">
<filename>controller.php</filename>
<filename>test.php</filename>
<filename>index.html</filename>
<filename>models/test.php</filename>
<filename>models/index.html</filename>
<filename>views/index.html</filename>
<filename>views/test/index.html</filename>
<filename>views/test/view.html.php</filename>
<filename>views/test/tmpl/default.php</filename>
<filename>views/test/tmpl/index.html</filename>
</files>
</administration>
<params>
<param name="test" type="text" default="" label="test" description="test" />
</params>
</install>

Make sure you're configuring the params correctly in both places config is needed.
In COMPONENTNAME.xml, you need the block you've got above (although I think only 'name' and 'default' are used here).
Also, in admin/config.xml, you'll need something like:
<root>
<params>
<param type="text" name="test" size="30" label="test" description="test" />
</params>
</root>
You'll then need to make sure there's a way to get to these config options, with this in your 'toolbar.COMPONENTNAME.html.php':
JToolBarHelper::preferences('com_magentocatalogue');
Then, a 'config' button should appear in the toolbar for your component. Only once you save some changes will these parameters appear in the #__components.params field.

Related

How to create reusable Components in .NET MAUI?

I have just recently started using .Net MAUI. But now I'm wondering how to use a piece of code, e.g. a self-made navigation bar on all my pages, because it doesn't make sense to write the same code on all 10 pages. I like to know if there is a way to create a component that can be reused like in React or Angular?
PS: This question is not specific to a navigation bar but to the general reuse of code in .NET MAUI.
I have so far watched various videos & articles on this topic, however, it is more about custom controls and did not help me. Most articles corresponded to what was conveyed in this video. I also came across this article, but it didn't help me either.
Thanks for your help :)
First, you can create a new .xaml file named Name.xaml. You can write some codes in it.
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="CusComponents.Name">
<ContentView.Content>
<StackLayout Padding="10">
<Label Text="Name" FontAttributes="Bold" />
<Label Text="First name" />
<Entry x:Name="FirstName" Placeholder="First name" />
<Label Text="Last name" />
<Entry x:Name="LastName" Placeholder="Last name" />
</StackLayout>
</ContentView.Content>
</ContentView>
Second, you can use it in the page you want like this. You need to add an xmlns reference to the top of the XML file– this is like a using statement in a C# file. Using the namespace structure for the sample project, this will be xmlns:custom_components="clr-namespace:CusComponents".
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:custom_components="clr-namespace:CusComponents"
x:Class="CusComponents.MainPage">
<custom_components:Name />
</ContentPage>
Here is the view of the code:

Embed a video object in html

I have this assignement where I have to used export for web in quicktime pro 7. Then copy/paste the read me.html file into the body (exactly as it is), which I did.
However, I keep getting 3 errors when I run my .html through W3C and cannot figure out how to correct it.
I realized there are probably better way to embed object but this is how they want us to do it for this assignment. Can anyone help me correct these 3 errors please.
Many thanks in advance.
<object width="350" height="278">
<param name="src" value="swiss/swiss-poster.jpg" />
<param name="href" value="swiss/swiss.mov" />
<param name="target" value="myself" />
<param name="controller" value="false" />
<param name="autoplay" value="false" />
<param name="scale" value="aspect" />
<embed width="350" height="278" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"
src="swiss/swiss-poster.jpg"
href="swiss/swiss.mov"
target="myself"
controller="false"
autoplay="false"
scale="aspect">
</embed>
</object>
Line 1 : Element object is missing one or more of the following attributes: data, type.
Line 14: Attribute href not allowed on element embed at this point.
scale="aspect">
Line 15: Stray end tag embed.
I just needed to embed a quicktime movie myself, and I looked to the Mozilla Developer Network for the syntax: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object
I believe that the data attribute would take the place of href in your params:
param name="href" value="swiss/swiss.mov" />
would be:
<param name="data" value="swiss/swiss.mov" />
and the type in this case would be "video/quicktime":
<param name="type" value="video/quicktime" />
There is also an <embed> reference at MDN (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/embed), but it covers only the HTML5 version of the element, which doesn't require a closing </embed> tag.
The reference at sitepoint (http://reference.sitepoint.com/html/embed) addresses the earlier syntax, and also says:
"embed isn’t part of any currently recognized standard (it is included in HTML5 which is not yet finalized), so if you use it, your page can’t possibly validate".
That suggests that with <embed> you should probably focus more on actual behavior in the browser than the W3C's validation tool.

How to retrieve items as a collection from a custom configuration section of an app.config file?

I have a custom configuration section defined in my app.config file. I need to get the tags and the sub tags within the created custom configuration section as a collection.
My config section is as follows,
<configSections>
<section name="myServices" type="NameSpace.ClassName, AssemblyName" />
</configSections>
<myServices>
<Tag1>
<subTag1 value="1"/>
<subTag2 value="2"/>
</Tag1>
<Tag2>
<subTag1 value="3"/>
<subTag2 value="4"/>
</Tag2>
</myServices>
My requirement is to get subtag values under each Tag as a collection.
Please help me to sort this out if any one gone through this before..
You can find very good artical here...
http://devlicio.us/blogs/derik_whittaker/archive/2006/11/13/app-config-and-custom-configuration-sections.aspx

Orchard CMS adding fields to page in custom recipe?

Is there any way to have a custom recipe add some text and image fields to the page? It looks like part of the recipe handles commands, but I can't find any commands that do this at # http://docs.orchardproject.net/Documentation/Using-the-command-line-interface
Update
Thanks for the response Bertrand, but there are some issues with that.
I exported everything for a recipe from a tenant that has 1. added fields, 2. added parts to the Page along with 3. an added List and 4. an added container widget to the Default layer that shows the list.
<Metadata>
<Types>
<Page ContentTypeSettings.Draftable="True" TypeIndexing.Included="true">
<TagsPart />
<LocalizationPart />
<TitlePart/>
<AutoroutePart />
<ContainablePart />
<AmazonProductsPart />
<YouTubeVideosPart />
</Page>
</Types>
<Parts>
<BodyPart BodyPartSettings.FlavorDefault="html" />
<Page ContentPartSettings.Attachable="True">
<Thumbnail.ImageField DisplayName="Thumbnail" ImageFieldSettings.MaxHeight="75" ImageFieldSettings.MaxWidth="75" ImageFieldSettings.Required="False" ImageFieldSettings.AlternateText="True" ImageFieldSettings.ResizeAction="Validate" />
<PageImage.ImageField DisplayName="PageImage" ImageFieldSettings.MaxHeight="250" ImageFieldSettings.MaxWidth="0" ImageFieldSettings.Required="False" ImageFieldSettings.AlternateText="True" ImageFieldSettings.ResizeAction="Resize" />
<PreContent.TextField DisplayName="PreContent" ImageFieldSettings.MaxHeight="0" ImageFieldSettings.MaxWidth="0" ImageFieldSettings.Required="False" ImageFieldSettings.AlternateText="False" ImageFieldSettings.ResizeAction="Validate" TextFieldSettings.Flavor="Html" TextFieldSettings.Required="False" />
<PostContent.TextField DisplayName="PostContent" ImageFieldSettings.MaxHeight="0" ImageFieldSettings.MaxWidth="0" ImageFieldSettings.Required="False" ImageFieldSettings.AlternateText="False" ImageFieldSettings.ResizeAction="Validate" TextFieldSettings.Flavor="Html" TextFieldSettings.Required="False" />
</Page>
</Parts>
</Metadata>
...
<Data>
<List Id="/alias=page-list" Status="Published">
<CommonPart Owner="/User.UserName=admin" CreatedUtc="2012-05-26T22:52:20Z" PublishedUtc="2012-05-26T22:57:37Z" ModifiedUtc="2012-05-26T22:57:37Z" />
<AutoroutePart Alias="page-list" UseCustomPattern="false" />
<AdminMenuPart AdminMenuPosition="2" OnAdminMenu="false" />
<MenuPart MenuText="Page List" MenuPosition="3" OnMainMenu="false" />
<ContainerPart ItemContentType="Page" ItemsShown="true" Paginated="true" PageSize="10" OrderByProperty="CommonPart.CreatedUtc" OrderByDirection="1" />
<TitlePart Title="Page List" />
</List>
<ContainerWidget Id="" Status="Published">
<CommonPart Owner="/User.UserName=admin" Container="/Layer.LayerName=Default" CreatedUtc="2012-05-26T22:55:42Z" PublishedUtc="2012-05-26T22:55:42Z" ModifiedUtc="2012-05-26T22:55:42Z" />
<WidgetPart Title="Page List" Position="1" Zone="AsideFirst" RenderTitle="false" />
<ContainerWidgetPart Container="/alias=page-list" PageSize="5" OrderByProperty="CommonPart.CreatedUtc" OrderByDirection="1" ApplyFilter="false" FilterByProperty="CustomPropertiesPart.CustomOne" FilterByOperator="=" />
</ContainerWidget>
</Data>
I then inject that into a copy of the default recipe with the appropriate modules activated.
When creating a new tenant from that recipe,
All the modules are enabled, good
The list is created, good
The page has the added parts, good
The page does not have the added fields, bad
The container widget does not exist, bad
It looks like the part fields are not added, and the widget was not created.
I did another simple test, and it looks like a bug?
Repro Steps:
Add fields to the page
Add a widget
Export everything
delete the widget
Import the exported xml
Expected: The widget to be back
Actual: the widget is still missing
is the recipe suppose to honor page fields and widgets, did I do something wrong, or is this a bug?
Update
Okay, this has to be a bug. When manually adding the fields, I get this message even though it isn't showing the fields: "A field with the same name already exists."
You don't need a command, this is supported by recipes without that. The easiest way to get an example is to add a field from the admin UI, and then export the metadata and examine the recipe that created.

Magento: local.xml doesn't show block

So I have empty package where is stored local.xml
(Paths I don't describe here, all caches disabled, error logs turned on).
I've added static block in admin panel. It is named "two_level_links".
Then I added code to local.xml:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="header">
<remove name="top.links"/>
<block type="cms/block" name="topTwoLevelLinks">
<action method="setBlockId">
<block_id>two_level_links</block_id>
</action>
</block>
</reference>
</default>
</layout>
In the header phtml file call it:
<?php echo $this->getChildHtml('topTwoLevelLinks') ?>
top.links disappeared but topTwoLevelLinks didn't appear.
Then I looked at Mage_Core_Model_Layout_Update and set a var_dump for getFileLayoutUpdatesXml [$layoutXml]. The source has my block.
Cannot understand what I should do next. How to debug it? Or where I'm doing wrong?
everything looks fine, but let me suggest you to check next things:
Check in admin panel if your block is enabled.
If you have more than one store view, please check if you your block is associated to your current store view, that you see on the frontend
Check in which folder header.phtml file is placed. For example if you changed the header.phtml from your base theme folder "app/design/frontend/base/default", Magento never will know about it if you also have header.phtml in "app/design/frontend/custom_package/custom_theme/" ... if it is not clear enough, please read: http://www.magentocommerce.com/knowledge-base/entry/magentos-theme-hierarchy

Resources