Namespace/Mymodule/Block/Item.php file code not accessible on frontend after adding through xml - zend-framework

i am working on a module e.g "Mymodule", in which i need to filter the results. i.e. for Partners i created Partner.php and for Community i created Community.php in
Mymodule/Block/Partner.php
Mymodule/Block/Community.php
Now i wanted to access their code in frontend through Mymodule.XML
<block type="mymodule/partner" ......................... />
but this doesn't work on LIVE SERVER, although it does work on local Wamp server :( ... Any idea ?
Although when i access the default Mymodule.php code in the same and add the code i placed in partner and community file, it does work.
Is there something i am missing ?

First, you have to define the blocks in your module's config.xml:
<config>
<global>
<blocks>
<mymodule>
<class>Namespace_Mymodule_Block</class>
</mymodule>
</blocks>
</global>
</config>
Second, you have to use the right block type in your layout XML:
<block type="mymodule/partner" ......................... />
You must not write ".php" in the block type. Note, that the term "mymodule" has to be the same in the config xml as well as in the block type.
Hope this helps!

I'm not strictly sure how your code would ever have worked. But assuming you haven't built a module before, you'll need a minimum of 3 files.
app/etc/modules/Sonassi_Module.xml
app/code/community/Sonassi/Module/etc/config.xml
app/code/community/Sonassi/Module/Block/Partner.php
In the first file ... app/etc/modules/Sonassi_Module.xml
<?xml version="1.0"?>
<config>
<modules>
<Sonassi_Module>
<active>true</active>
<codePool>community</codePool>
</Sonassi_Module>
</modules>
</config>
In the second file ... app/code/community/Sonassi/Module/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Sonassi_Module>
<version>0.1.0</version>
</Sonassi_Module>
</modules>
<frontend>
<routers>
<module>
<use>standard</use>
<args>
<module>Sonassi_Module</module>
<frontName>module</frontName>
</args>
</module>
</routers>
</frontend>
<global>
<blocks>
<module>
<class>Sonassi_Module_Block</class>
</module>
</blocks>
</global>
</config>
In the third file ... app/code/community/Sonassi/Module/Block/Partner.php
class Sonassi_Module_Block_Partner extends Core_Block_Template
{
}
Then finally, you can then use
<block type="module/partner" ......................... />

Related

Azure Devops release - File Transform - Provided node is empty or a comment

I am trying to transform a .config file from an XML transform file in a release stage. I am using the standard File Transform task. I added a transform.xml file (which isnt linked to a legitimate release) to my artifact and can see it. When i try and use it I get the following System.Debug output:
2020-05-01T17:25:21.6011428Z Processing substitution for xml node : connectionStrings
2020-05-01T17:25:21.6022113Z ##[debug]Provided node is empty or a comment.
2020-05-01T17:25:21.6025339Z ##[debug]Provided node is empty or a comment.
2020-05-01T17:25:21.6027416Z ##[debug]Unable to find node with tag 'configSections' in provided xml file.
2020-05-01T17:25:21.6028615Z Skipped Updating file: xxxxxxxx.config
The contents of the transform.xml file are as below:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings xdt:Transform="Replace">
<add name="XX" connectionString="user id=XXX;password=XXXXX;data source=XXXXXXXX"/>
</connectionStrings>
</configuration>
Azure Devops release - File Transform - Provided node is empty or a comment
I could not reproduce this issue with following configuration file and your transform file:
Configuration file web.config (code sample from XML transformation example):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="DefaultConnection"
connectionString="Data Source=(LocalDb)\\MSDB;DbFilename=aspcore-local.mdf;" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<authentication mode="None" />
<compilation targetFramework="4.5" debug="true" />
</system.web>
</configuration>
Then create a Web.test.config with your contents of the transform file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings xdt:Transform="Replace">
<add name="XX" connectionString="user id=XXX;password=XXXXX;data source=XXXXXXXX"/>
</connectionStrings>
</configuration>
Note:
XML transformation will be run on the *.config file for transformation configuration files named *.Release.config or *.<stage>.config. So, we could not use the transform.xml instead of *.<stage>.config.
As the test result, the connectionStrings string in the web.config was replaced:
Please check the document File transforms and variable substitution reference for some more details.
Hope this helps.

mybatis NOT printing queries in console

I've follower a lot of how-tos, tutorials, guides and answers (here on SO) but still I'm unable to print queries (and their results) into Eclipse's console...
Even though I've done everything I could I'm 100% sure I'm missing something...
The mapper is in a XML class. The following is mybatis-config.xml:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE configuration
PUBLIC '-//mybatis.org//DTD Config 3.0//EN'
'http://mybatis.org/dtd/mybatis-3-config.dtd'>
<configuration>
<typeAliases>
</typeAlias>
<mappers>
<package name="com.app.dao.persistence" />
</mappers>
<typeHandlers>
<package name="com.app.typehandler" />
</typeHandlers>
<settings>
<setting name="logImpl" value="LOG4J"/>
</settings>
</configuration>
And this is the log4j.properties:
# Console output...
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n
log4j.rootLogger=warn, stdout, ERROR
log4j.logger.com.app.portal=info, debug
log4j.logger.org.springframework=info
log4j.logger.com.ocpsoft=info
# MyBatis logging configuration...
log4j.logger.com.app.dao.persistence.MyMapper=TRACE
The XML is, obviously, in: com.app.dao.persistence.MyMapper

What is wrong with my layer.xml from netbeans?

I try to create a new palette in netbeans 10, but the following 2 errors don't allow me to compile the project:
Document root element "folder", must match DOCTYPE root "JavaPalette". [3]
The markup in the document following the root element must be well-formed. [11]
My XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<folder name="JavaPalette">
<folder name="Items">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.javasourcefilepalette.Bundle"/>
<file name="Item.xml" url="resources/Item.xml">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.javasourcefilepalette.Bundle"/>
</file>
</folder>
</folder>
<filesystem/>
I have no clue what both error messages mean, but i did exactly what is said in the tutorial.
Online validation of the xml file also shows that error.
https://platform.netbeans.org/tutorials/nbm-palette-api2.html
I didn´t followed the tutorial, but as far as i can tell, your filesystem tag is not valid. If you take a look at the DTD you can see that the element filesystem isn´t declared as EMPTY (for more information you can read more about it here). So you have to provide a start and end tag. In your posted example you are only using <filesystem/> which isn´t allowed.
You have to change the xml as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
<filesystem>
<folder name="JavaPalette">
<folder name="Items">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.javasourcefilepalette.Bundle"/>
<file name="Item.xml" url="resources/Item.xml">
<attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.modules.javasourcefilepalette.Bundle"/>
</file>
</folder>
</folder>
</filesystem>

zend-framework navigation

i have this xml file for Creating a container ,
if i want create a db for save this items and and create container from db
how should i do ?
<?xml version="1.0" encoding="utf-8"?>
<config>
<nav>
<logout>
<label>logout</label>
<controller>authentication</controller>
<action>logout</action>
<resource>logout</resource>
</logout>
<login>
<label>login</label>
<controller>authentication</controller>
<action>login</action>
<resource>login</resource>
</login>
<test>
<label>test</label>
<uri>#</uri>
<resource>test</resource>
<pages>
<list>
<label>list</label>
<controller>tset</controller>
<action>listtest</action>
</list>
<archive>
<label>archive</label>
<controller>myarchive</controller>
<action>archive</action>
</archive>
</pages>
</test>
</nav>
</config>
and code in bootsrap
$navContainerConfig = new Zend_Config_Xml(APPLICATION_PATH . 'navigation.xml', 'nav');
$navContainer = new Zend_Navigation($navContainerConfig);
Why do you need to store this in database?
If you really need, the best way is nested set.
You may also just serialize the array and save to the database.
You may also use Zend_Config_Xml_Writer instead of the database.

Reading values from property file through NANT

How can I read a value alone from the property file. For example, how can I read the values of build.home or temp.dir from the below example.
contents of env.properties
build.home=c:\build
temp.dir=c:\temp
Regards
Sarathy
We do this in a slightly different format for Nant.
In your build file:
<include buildfile="./env.properties" failonerror="true"/>
env.properties:
<?xml version="1.0" ?>
<project>
<property name="build.home" value="c:/build"/>
<property name="temp.dir" value="c:/temp"/>
</project>