How to include file include at asp.net? - .aspxauth

I m developing a .asp site for my a client. I m new at .asp, I know file including in php. Such:
<?php include("inc/contact.php"); ?>
But I try at asp this way.But Not work. I got a blank page. Now I would like to know: How to include file include at asp.net?

To include any file at .asp, just type like bellow:
<!-- #include file="inc\contact.asp" -->
Importants matter is that, the Slash will left slash(\).

Related

Change the friendly URL of a web content in Liferay

I am currently using an article display page to display my web content in Liferay 6.2. I'm trying to figure out how to edit the path of my friendly URL after the /-/.
Current URL: siteName/-/articleName
Desired URL: siteName/-/topicSection/articleName
You are talking about the attribute JournalArticle.urlTitle. The problem is, that there is no UI in Liferay, which lets you change that attribute (at least not out of the box).
You've got two options:
If you just want to change an existing article, you can change that attribute in the database (I'd guess that the additional / is no problem):
UPDATE JournalArticle
SET urlTitle = 'topicSection/articleName'
WHERE urlTitle = 'articleName'
If you want to offer an UI for editing that attribute, you could write a hook.
Here a short summary how to write such a hook:
Add this lines to your liferay-hook.xml:
<portal-properties>portal.properties</portal-properties>
<language-properties>Language.properties</language-properties>
<custom-jsp-dir>/WEB-INF/custom_jsps</custom-jsp-dir>
Create a file portal.properties in the Java source directory and add this line:
journal.article.form.update = urlTitle
Create a file Language.properties in the Java source directory and add this line:
urlTitle = Friendly URL
Add a file WEB-INF/custom_jsps/html/portlet/journal/article/urlTitle.jsp into the web content folder:
<%# include file="/html/portlet/journal/init.jsp" %>
<% JournalArticle article = (JournalArticle)request.getAttribute(WebKeys.JOURNAL_ARTICLE); %>
<aui:model-context bean="<%= article %>" model="<%= JournalArticle.class %>" />
<h3>Friendly URL</h3>
<aui:input name="urlTitle" />

Unable to use Liferay Freindly URL Mapper

I was following this document from Liferay Website to work Map Firendly URL Mappings
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/adding-friendly-url-mapping-to-the-portlet
I am using Liferay version=6.1.0
During HyperLink navigation , i was getting the following url
http://localhost:8080/web/guest/what-we-do?p_p_id=sai_WAR_Saiportlet&
p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1
&_sai_WAR_Saiportlet_jspPage=%2Fhtml%2Fsai%2Fedit.jsp
To modify the above i have tried to use Friendly URL Mapper and i have done the following way
Inside liferay-portlet.xml file .
<portlet>
<portlet-name>sai</portlet-name>
<icon>/icon.png</icon>
<friendly-url-mapper-class>com.liferay.portal.kernel.portlet.DefaultFriendlyURLMapper</friendly-url-mapper-class>
<friendly-url-mapping>sai</friendly-url-mapping>
<friendly-url-routes>com/test/sai-friendly-url-routes.xml</friendly-url-routes>
<instanceable>false</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>
/js/main.js
</footer-portlet-javascript>
<css-class-wrapper>sai-portlet</css-class-wrapper>
</portlet>
Created a new file by name sai-friendly-url-routes.xml inside
D:\liferay-plugins-sdk-6.1.0-SNAPSHOT\portlets\Sai-portlet\docroot\WEB-INF\src\com\test\sai-friendly-url-routes.xml
The content inside sai-friendly-url-routes.xml is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE routes PUBLIC "-//Liferay//DTD Friendly URL Routes 6.1.0//EN" "http://www.liferay.com/dtd/liferay-friendly-url-routes_6_1_0.dtd">
<routes>
<route>
<pattern>/{mvcPathName}</pattern>
<generated-parameter name="mvcPath">/{mvcPathName}.jsp</generated-parameter>
</route>
</routes>
But i observed there is no change in the url
http://localhost:8080/web/guest/what-we-do?p_p_id=sai_WAR_Saiportlet&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_sai_WAR_Saiportlet_jspPage=%2Fhtml%2Fsai%2Fedit.jsp
Please let me know where exactly i am doing mistake .
You leave the values as they are. That is, you leave {mvcPathName} and "mvcPath" as-is.
When the friendly URL is generated, it parses mvcPath (i.e., edit.jsp or view.jsp) from the URL and then the pattern is applied, replacing .../edit.jsp with .../edit.
This example works for the edit JSP. And it works for the view page; but NOT when clicking Save ... which is something I could look into. However, if you go to edit and then click the back link, the friendly URL will show for the view JSP.
I've created a ticket to complete this example so that it also goes to a friendly URL when clicking save. I'll update this section when we've made the fix.
Thanks.

Zend Framework deployment to a subdomain

I am using Zend Framework to develop some application. I develop on my localhost and then I upload it to some subdomain like abc.mydomain.com. When I upload my layout index.phtml, I get the following for all URLs:
abc.mydomain.com/css/base.css 404 (Not Found)
on the web browser console but my CSS is in the public folder.
my code to link this css is :
<?php echo $this->headLink()->appendStylesheet('/css/base.css') ?>
What should i do to make these addresses work ?
To complete my question : How does the framework distinguish between a folder and a controller or How could i tell the framework to don't act on these URL ass action , they are folders ?
Sounds like a mapping issue associated to the hosting the subdomain. Often on shared hosting you cannot map the project's public folder to the subdomain. So a variety of rewrite tricks are required to map requests for pages and assets into the right directories without confusing ZF about the requested URL.
Check out:
http://www.papayasoft.com/2010/05/08/zend-framework-shared-hosting/
for a description of the problem and various approaches to solving it.
Usually, the baseUrl() view-helper detects (internally, using the Zend_Controller_Front::getBaseUrl() method) what your app's base-url is.
But sometimes, depending upon your vhost setup and the location of your public folder within the doc root - you need to tell the app explicitly what your base-url is.
In application/configs/applicatiom.ini, you can set:
resources.frontController.baseUrl = "http://abc.mydomain.com"
Then in a view-script, you can access public assets using the baseUrl() view-helper and a relative url (relative to the base you set), as follows:
<?php echo $this->headLink()->appendStylesheet($this->baseUrl('css/base.css')) ?>
though I see many people use it as a prefix-only:
<?php echo $this->headLink()->appendStylesheet($this->baseUrl() . '/css/base.css') ?>

Redirect to same named page in directory structure before path changes

Well, say I have a number of html pages in my web. The case is that I´m doing changes sometimes in the directory structure, so when anybody try to access to a determinated URL, it's possible that such URL does not exit. The files names don't change but so do the paths.
As far as I now, the server takes the user to a "404" page that can be customized. Is possible to customize the page in this way?:
The user tries oneweb.com/oldpath/page.html; which does not exist.
A 404 customized page is launched
404 page runs an script IS THIS POSSIBLE?
The script is given the name of the file WHERE IS STORED SUCH NAME?
The script search the entire directory structure to find page.html HOW TO ACCESS TO THE STRUCTURE
The file is found and the new URL is stored: oneweb.com/newpath/page.html
a link appears showing the new URL
Maybe this process is relatively common and I can find some related code or tutorial?
Are you using Apache? Linux?
Add a 404 handler
ErrorDocument 404 /404.php
Then use 404.php to parse the url. This simple example just grabs everything after the last / in the URI so http://example.com/foo/bar/page.html would put page.html in $url:
$url = end(explode('/', $_SERVER['REQUEST_URI']));
Then use one of the comment example functions in http://php.net/manual/en/function.readdir.php to search your directory and find the file.
Then do a header 301 redirect
header ('HTTP/1.1 301 Moved Permanently');
header ('Location: http://example.com/' . $file_path);

Zend modules with form

I am new to Zend Framework. I am using modules for front end and admin panel.
In the admin panel, I would like to have login form, then the folder structure is
application/
modules/
backend/
controllers/
LoginController.php
forms/
LoginForm.php
views/
scripts/
login/
index.phtml
I am having an error "Fatal error: Class 'Backend_Forms_LoginForm' not found in D:\wamp\www\ioc\Application\modules\backend\controllers\LoginController.php on line 9"
Please help me to fix this.
Thanks.
I created controller and forms using following URL http://weierophinney.net/matthew/archives/165-Login-and-Authentication-with-Zend-Framework.html
In the controller, it call the form by
return new Backend_Forms_LoginForm(array(
'action' => '/login/process',
'method' => 'post',
));
Please help me to fix this.
If you're using standard autoloading, your form's class should be named exactly Backend_Form_LoginForm ('form' in singular).
Also make sure that you have a bootstrap for Backend module in place.
I don't know why it won't work... it sould...
by the way, a lot of developers that I met use to put all the forms into the default form directory or into the Library directory, so the can change the name as they prefer without doing includes or something else.
in your case you can try create /library/backend/forms and write the form in the same way as you writed