tag:blogger.com,1999:blog-38088461063715919372024-03-06T09:25:43.536+11:00Code-Tips.com - Web Development, Programming, SEOWeb Development & Programming in PHP, ASP.NET, XML, VB, .NET Framework, JavaScript and HTML/CSS for Web Applications, Internet Marketing and SEODanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.comBlogger52125tag:blogger.com,1999:blog-3808846106371591937.post-75340332705424548362012-07-05T22:56:00.000+10:002012-07-06T00:47:05.633+10:00VBScript Web Services / SOAP (References)The following is a set of resources to help when working with <b>SOAP Web Services from VBScript</b>. Resources include tutorials, examples and forum threads relating to working with SOAP Web Services via VBScript (VBS).<br />
<br />
<a name='more'></a><br />
<a href="http://www.developerfusion.com/article/24/xml-soap/3/"><b>XML SOAP (Tutorial)</b></a><br />
Tutorial explaining how to call SOAP Web Services using a VBScript client, including a sample XML document containing the details of the SOAP request to be sent to the Web Service / Server.<br />
<br />
<a href="http://www.codeproject.com/Articles/20125/Using-SOAP-With-Classic-ASP-VBScript"><b>Using SOAP With Classic ASP / VBScript</b></a><br />
This tutorial by AdamNThompson demonstrates the use of SOAP Web Services from classic ASP / VBScript with an example that updates an existing record, or adds a new record if one doesn't already exist.<br />
<br />
<a href="http://www.example-code.com/vbscript/http_soap.asp"><b>SOAP Example (VBScript)</b></a><br />
This article contains example VBScript code to send a SOAP request and get an XML Response. An XML request is generated and sent to the Web Service. The response (if successful request) is parsed to extract the value from a specific element within the result XML, which is saved to a text file.<br />
<br />
<a href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/consuming-and-using-a-web-service-from-within-vbscript-to-create-a-whois-tool/"><b>Consuming and using a web service from within VBScript to create a WHOIS tool</b></a><br />
This article demostrates how to consume a Web Service using VBScript to create a WHOIS tool. The WHOIS Web Service in the article is a free public Web Service.<br />
<br />
<a href="http://www.devarticles.com/c/a/ASP/An-Introduction-To-XML-SOAP-Using-ASP-and-VB6/"><b>An Introduction To XML SOAP Using ASP and VB6 (5 pages)</b></a><br />
Tutorial providing an introduction to working with XML SOAP Web Services using AXP and VB6.<br />
<br />
<a href="http://www.pocketsoap.com/samples/default.aspx?cat=VBScript"><b>VBScript SOAP - Samples</b></a><br />
A range of VBS code samples on PocketSOAP.com for working with XML SOAP from VBScript.<br />
Examples:<br />
Controlling Array Type Serialization in scripting language<br />
Calling Weblogs.com [XML-RPC]<br />
Calling the Google API<br />
Edgar search<br />
Interop demos<br />
Handling Type mappings<br />
VBScript Stock Quote<br />
Arrays from Scripting<br />
Calling Weblogs.com [SOAP]<br />
<br />
<br />
<b>Forum Threads/Questions about XML SOAP / Web Service Requests using VBScript</b><br />
<br />
<a href="http://social.technet.microsoft.com/Forums/en/ITCG/thread/4333a2e0-c090-4b8d-a0b2-e1a92d6f6b58"><b>VBScript SOAP Call (Thread)</b></a><br />
Simple example requried to assist with getting started with SOAP requests using VBScript.<br />
"You need to create a proxy to use SOAP (Web Services) within VBScript."<br />
User jrv, answered the question by building a simple working example for returning data from a Web Service.<br />
<br />
<a href="http://social.msdn.microsoft.com/Forums/en/xmlandnetfx/thread/5e76ac21-0fa4-4492-bcc1-3c73ea5b3848"><b>Calling an ASMX web service from VBScript run-time</b></a><br />
Issue with formatting of CDATA tag. <br />
<br />
<a href="http://forum.bigfix.com/viewtopic.php?id=5287"><b>Using SOAP with VBScript (Thread)</b></a><br />
Question regarding working with SOAP (MSSOAP.SoapClient) from VBScript. Connection to SOAP is ok, but only 1 line is returned. Issue in this case relates to character encoding on the XML sent as the SOAP request.<br />
<br />
<a href="http://stackoverflow.com/questions/2020211/sending-a-application-soapxml-soap-request-using-classic-asp"><b>Sending a 'application/soap+xml' SOAP request using Classic ASP (Thread)</b></a><br />
Suggestions from multiple users to troubleshoot/resolve a SOAP Request issue ("HTTP 400 Bad Request" error) using Fiddler or SoapUI.<br />
<br />
<a href="http://bytes.com/topic/net/answers/178691-sending-soap-over-http"><b>Sending soap over http - .NET (Thread)</b></a><br />
Custom Web Service - Querying the custom Web Service using VBScript.<br />
wsdl.exe tool (.NET), SOAP Toolkit (VBScript)<br />
<br />
<br />
<br />
<b>Related:</b><br />
<ul>
<li><a href="http://www.code-tips.com/2009/04/vbscript-string-clean-function-remove.html">VBScript String Clean Functions -3 Methods to Remove or Replace Characters in a String</a></li>
<li><a href="http://www.code-tips.com/2009/03/microsoft-outlook-calling-vba-class.html">Microsoft Outlook: Calling VBA Class Module function using VBScript</a></li>
</ul>
<br />DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-37980098257649763172011-09-05T18:50:00.003+10:002011-09-16T18:22:51.499+10:00DIY SharePoint Marketing Tips & Tools - Do Follow SharePoint Article LibrariesLooking for places to help<b> promote your SharePoint products or website</b> using legitimate means? In this article I provide information and tips about how you can promote your products or services yourself for free. The article has a focus on promoting a website relating to SharePoint, but the tips are applicable to any type of product or service being marketing online. A few websites providing free (Do Follow) SharePoint Article Libraries are also provided. <br />
<a name='more'></a><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNoQCzyqgTJsRO5lJBLWgLkrxJup88bEu0HG9tn3QRmVOC4vgs4hbe3NtP20nAz7dwSL3tHzFWw804__b8apYblBc-1YDoZ7OaXbkbBKWXoMm3fOaCWYLkCk-8yx50ty3BvswODgQKcxo/s1600/graph.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="256" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNoQCzyqgTJsRO5lJBLWgLkrxJup88bEu0HG9tn3QRmVOC4vgs4hbe3NtP20nAz7dwSL3tHzFWw804__b8apYblBc-1YDoZ7OaXbkbBKWXoMm3fOaCWYLkCk-8yx50ty3BvswODgQKcxo/s320/graph.jpg" width="320" /></a></div><b>Submitting articles can be a great way of gaining exposure</b> to your SharePoint website or products, giving you complete control over the quality of content used to market your products. Don't leave the job to a company who may use unethical or immoral tactics to promote your site. The people behind these "shady" services will almost never disclose the actual methods used to promote their client's site because they would be putting their own business at risk, or wouldn't be selected as a viable service to assist with online marking at all. Popular Search Engines are working constantly to <b>eliminate spam and other types of pollution</b> from their search results, so why risk using cheap outsources SEO services who use these methods, that will provide little benefit to you, or in many cases have a negative effect?<br />
<br />
If the <b> reputation of your company</b>, website, products and services is important to you, then you need to be very careful about who you choose to market your website when outsourcing. You will generally get what you pay for, but not in every case. To help manage or eliminate this risk, there are many things that you can do to promote your own site that keep you in control of the quality of content used to promote your site.<br />
<br />
<br />
Writing and submitting high quality and useful articles that relate to your company's SharePoint products and services is <b>one method that presents little or no risk</b>. Each article should be submitted to a website that is relevant to your own to increase it's promotional value. There are a few key benefits that submitting to a website related to yours will provide:<br />
<ol><li> <b>Readers of your article will be more interested in your website</b>, product or service and much more likely to visit your website as a result of reading the article.</li>
<li>People that stumble across your article when browsing the site are more likely to be interested, <b>not relying on Search Results</b>.</li>
<li>The article and links to your website <b>provide more value and impact in regards to positioning in Search Engines</b>.</li>
</ol><b>Some Other Marketing Tips & Considerations for Article Submission:</b><br />
<ul><li><b>Writing an article that is high quality and useful</b> on it's own, as well as providing value to the users of the website you submit to is very important. Following these basic guidelines will almost guarantee that any additional time spent is worth while.</li>
<li>If the website you submit to <b>allows links</b> to be included in an article, and if the article page and links are <b>visible and accessible to Search Engines</b>. In more technical terms, the page displaying your submitted article should be "Indexed" and "Followed". You can usually assume that if a page does not explicitly provide these instructions to Search Engines that it is both Indexed and Followed (defaults), but there are other less obvious methods to implement equivalent restrictions that you should check for such as the use of a "robots.txt" file.</li>
<li>Too many links generally diminishes the overall quality of an article, especially if they are not closely related to the topic covered in the article.</li>
<li>Try to select a topic that will allow you to include a descriptive link to your website or product page that adds value to the article.</li>
<li>Although it may seem tempting and common, submitting a single article to more than one location on the Internet should be avoided, as it is only creating duplicate content. Submitting duplications is essentially creating spam regardless of the article quality. This will reduce the impact on your site that the copies provide and will likely result in the time spent writing and submitting the article being a waste.</li>
</ul>As mentioned earlier, the following are a few SharePoint related <b>websites with article libraries</b> that you can use for free. Articles submitted to these libraries are included in Search Engines, and links to your site are followed (Do Follow).<br />
<ul><li><b>Master-SharePoint.com: <a href="http://www.master-sharepoint.com/">SharePoint Article Library</a></b> - Provides learning resources for SharePoint Developers, Administrators and End Users.</li>
</ul><br />
<ul><li><b>InfoPath-SharePoint.com: <a href="http://www.sharepoint-infopath.com/">InfoPath & SharePoint Articles</a></b> - Information to assist with developing solutions in SharePoint, including using technologies such as InfoPath Forms.</li>
</ul>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com1tag:blogger.com,1999:blog-3808846106371591937.post-37143255768175103262011-08-14T02:05:00.005+10:002011-08-14T02:15:04.131+10:00How to Generate Feed Using Php (Atom 1.0 and RSS 2.0 Compatible)<div class="c5 c1"></div><div class="c1"></div><div class="c1"><div class="separator" style="clear: both; text-align: center;"><a href="http://phpfeedwriter.webmasterhub.net/img/feed.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://phpfeedwriter.webmasterhub.net/img/feed.png" /></a></div>In this tutorial, I demonstrate <b><span class="c6">how to generate a feed using Php</span></b> that can be displayed from a website in multiple formats, including Atom 1.0 and RSS 2.0. I will be using functionality from the<b> <span class="c6 c9"><a class="c10" href="http://phpfeedwriter.webmasterhub.net/docs/feedwriter/__construct/">Php FeedWriter class library</a></span></b> to generate the feed, which is <b><span class="c6">available for free</span></b> at http://phpFeedWriter.webmasterhub.net/.</div><div class="c5 c1"></div><div class="c1"><br />
I have broken up the process below into separate components, and provided additional information to help you learn each aspect of creating the feed using Php. A download of the completed script written in this tutorial is also provided if required.</div><h3 class="c1"><a href="http://www.blogger.com/post-create.g?blogID=3808846106371591937" name="h.etnxw46bjtef"></a>Summary</h3><ul><li class="c3 c1">Prepare your feed script/page - Instantiate a (Php) FeedWriter Class Object</li>
<li class="c3 c1">Add additional (Channel) data to the feed</li>
<li class="c3 c1">Add Items to the Feed</li>
<li class="c3 c1">Get the specified feed output format</li>
<li class="c3 c1">(Optional) Set the “Content” element of each feed item as type “HTML”</li>
<li class="c3 c1">Output the Feed XML</li>
<li class="c3 c1">(Optional) Writing to a file / Caching Feed Content</li>
</ul><div class="c5 c1"></div><a name='more'></a><br />
<h4 class="c1 c15"></h4><h4 class="c1"><u>Prepare your feed script/page - Instantiate a (Php) FeedWriter Class Object</u></h4><div class="c1 c5"></div><ol class="c0" start="1"><li class="c3 c1"><b><span class="c9"><a class="c10" href="http://phpfeedwriter.webmasterhub.net/download/">Download the latest version of the Php feedWriter Class library</a></span> (free)</b></li>
</ol><ol class="c0" start="2"><li class="c3 c1"><b>Extract the package to a new directory on your web server that supports Php. </b> </li>
</ol><div class="c11 c1"><span class="c2">For the purpose of this example, have copied the Php FeedWriter class files to a "feed/" sub-folder.</span></div><div class="c1 c4"></div><ol class="c0" start="3"><li class="c3 c1"><b>Create a new file called "feed.php". </b></li>
</ol><div class="c1 c11"><span class="c2">This file will be used to serve the feed content, so must be accessible from your website.</span></div><div class="c4 c1"></div><ol class="c0" start="4"><li class="c3 c1"><b>Paste the following code into the file.</b></li>
</ol><div class="c11 c1"><br />
</div><div class="c11 c1"><br />
<pre class="php" name="code">/* Example Feed using Php FeedWriter http://phpFeedWriter.webmasterhub.net/
* Example feed: http://phpfeedwriter.webmasterhub.net/samples/1/feed.php
*
* View the tutorial: http://www.code-tips.com/2011/08/how-to-generate-feed-using-php-atom-10.html
*/
require_once('feed/FeedWriter.php');
//Block 1 ----------------------------------------------
//Title if the feed
$feed_title = 'Example Feed using Php FeedWriter';
//Feed Link. This should be a URL to the website, or blog that content displayed in the feed is from.
$feed_link = 'http://www.code-tips.com/';
//A short description of the feed.
$feed_description = 'This is an exmaple feed created as part of the tutorial on code-tips.com for generating RSS / Atom feeds using Php.';
//Instantiate the FeedWriter class
$feedWriter = new FeedWriter(
$feed_title, //Feed Title
$feed_description, //Feed Description
$feed_link, //Feed Link
6, //indent
true, //Use CDATA
null, //encoding
true //enable validation
);
//Enable debug
$feedWriter->debug = true;
</pre><br />
</div><div class="c11 c1"><br />
</div><div class="c4 c1"></div><ol class="c0" start="5"><li class="c3 c1"><b>In the code you have just pasted, replace the example title, description and feed link with your own.</b></li>
</ol><div class="c5 c1"></div><div class="c11 c1"><span class="c2">At this point, the an object has been created from the FeedWriter class, which will now be used to add items and later display the feed. The additional options included when instantiating an object from the FeedWriter class control how the feed is outputted. </span></div><ul><li class="c8 c1"><span class="c2">When developing the feed, you should enable </span><span class="c2 c6">validation</span><span class="c2"> to ensure that you have included enough information in the feed for it to be valid in each output format. </span></li>
<li class="c8 c1"><span class="c2">The option to </span><span class="c2 c6">enable CDATA</span><span class="c2"> will result in character data (CDATA) tags being written where text content is included in the feed. This may be required depending on the type of information you are adding to the feed, and how you would like it to be displayed. </span></li>
<li class="c1 c8"><span class="c2">It is also possible to set the </span><span class="c2 c6">character encoding</span><span class="c2"> for the feed output when constructing the FeedWriter object. In this example, I have set this to null so that it uses the default (EN-US). </span></li>
<li class="c8 c1"><span class="c2">Enabling validation ( $feedWriter->debug = true; ) will also assist when developing the feed, as additional information is provided when a feed is not valid instead of a generic message. The information includes the specific elements in the feed schema used to output the feed that were missing required information. Links are also provided to the relevant documentation on the Php FeedWriter website.</span></li>
</ul><ol class="c17" start="1"></ol><div class="c11 c1"><span class="c2">For more information about using the FeedWriter class constructor, see the online documentation: </span><span class="c2 c9"><a class="c10" href="http://phpfeedwriter.webmasterhub.net/docs/feedwriter/__construct/">FeedWriter Constructor</a></span><span class="c2">.</span></div><div class="c5 c1"></div><div class="c5 c1"><span class="c6"></span></div><h4 class="c1"><a href="http://www.blogger.com/post-create.g?blogID=3808846106371591937" name="h.la627coeau7i"></a> </h4><h4 class="c1"><u>Add additional (Channel) data to the feed</u></h4><div class="c1">There is a range of additional meta information that can be added to a feed, including dates (Published/Modified), author details, refresh intervals and categories. This information is used by feed readers and aggregators when updating and displaying your feed. Some feed formats require additional information to be included in the feed to be valid. </div><div class="c5 c1"></div><div class="c1">Many of the functions provided by the FeedWriter class can be used to add information to the feed as well as individual items in the feed. When these functions are called before items have been added to the feed, the data is associated with the feed itself. After items have been added, the data passed to one of these functions will be added to the item most recently added to the feed.</div><div class="c5 c1"></div><ol class="c0" start="6"><li class="c3 c1"><b>Paste the lines of code in the following steps one after another, after the first code block included in the file. Change the values as necessary.</b></li>
</ol><div class="c5 c1"></div><ul><li class="c3 c1">Set an image for the feed (Required for some RSS formats)</li>
</ul><ol class="c7" start="1"></ol><div class="c11 c1"><pre class="cpp" name="code">$feedWriter->set_image('WebmasterHub.net', 'http://www.webmasterhub.net/img/logo.jpg','http://www.webmasterhub.net/');
</pre></div><ul><li class="c3 c1">Specify the language of the feed content (Required for some formats)</li>
</ul><ol class="c7" start="2"></ol><div class="c11 c1"><pre class="cpp" name="code">$feedWriter->set_language('EN-US');
</pre></div><ul><li class="c3 c1">Specify the date that content in the feed was last updated (Required for Atom 1.0)</li>
</ul><ol class="c7" start="3"></ol><div class="c11 c1"><pre class="cpp" name="code">$feedWriter->set_date('2011-08-12T00:00:00Z',DATE_UPDATED);
</pre></div><ul><li class="c1 c3">Include contact details of the feed author (Required for Atom 1.0)</li>
</ul><ol class="c7" start="4"></ol><div class="c11 c1"><pre class="cpp" name="code">$feedWriter->set_author(null, 'Daniel','http://www.code-tips.com/');
</pre></div><ul><li class="c3 c1">Set the “Self Link”, which is the URL to the feed. (Required for Atom 1.0)</li>
</ul><ol class="c7" start="5"></ol><div class="c11 c1"><pre class="cpp" name="code">$feedWriter->set_selfLink('http://phpfeedwriter.webmasterhub.net/samples/1/feed.php');
</pre></div><div class="c4 c1"><span class="c6"></span></div><div class="c11 c1"><span class="c2">Refer to the </span><span class="c2 c9"><a class="c10" href="http://phpfeedwriter.webmasterhub.net/docs/feedwriter/">FeedWriter Class Documentation</a></span><span class="c2"> for a list of functions that can be called to add additional information to the feed.</span></div><div class="c5 c1"></div><div class="c5 c1"></div><h4 class="c1"><a href="http://www.blogger.com/post-create.g?blogID=3808846106371591937" name="h.1jlpt6ksdrk"></a> </h4><h4 class="c1"><u>Add Items to the Feed</u></h4><div class="c1">Items are added to the feed simply by calling the add_item() function. Different information is required depending on the specified output format, so it is good practice to include all, or as much information as possible. Some formats require that at least one of the title, description/content or link be included.</div><div class="c5 c1"></div><div class="c1">For the purpose of this example, I have added a number of static/hard coded items to an array. In reality, building a feed that retrieves information from a database or other dynamic source is a more common and practical solution. The “items” array is created for the purpose of demonstrating how to generate a feed using Php. You should replace this array with a similar array or source of information from your website. Using an associative array of a database query result is probably the easiest way to put the code in this example into practical use.</div><div class="c5 c1"></div><ol class="c0" start="7"><li class="c3 c1"><b>Paste the following code block into the file, after the previous code</b></li>
</ol><div class="c11 c1"><span class="c6"><br />
</span><br />
<br />
<pre class="php" name="code">//Block 3 ----------------------------------------------
//Create/Retrieve array containing data for the sample items
//this array should be replaced with your database query result array or similar
//## Section 3.1 - Items Array
$items = Array();
$items[] = Array(
//Example Item 1
'item_title' => 'Php FeedWriter Example Feed: Item',
'item_content' => 'This is an example item.
This HTML <i>should</i> be rendered when the feed is displayed in a browser or reader that supports HTML output...',
'item_link' => 'http://www.code-tips.com/link_to_post.html',
'item_published' => '2011-08-12T00:00:00Z',
'item_updated' => '2011-08-12T00:00:00Z');
$items[] = Array(
//Example Item 2
'item_title' => 'Php FeedWriter Example Feed: Item 2',
'item_link' => 'http://phpfeedwriter.webmasterhub.net/',
'item_published' => '2011-08-12T00:00:00Z',
'item_updated' => '2011-08-12T00:00:00Z');
//## Section 3.2 - Loop through the items array, add items to the feed
foreach($items as $item)
{
//Get the title, content, link for the current item if supplied.
if(isset($item['item_title']))
$item_title = $item['item_title'];
else
$item_title = null;
if(isset($item['item_content']))
$item_content = $item['item_content'];
else
$item_content = null;
if(isset($item['item_link']))
$item_link = $item['item_link'];
else
$item_link = null;
//Add the current item to the feed
$feedWriter->add_item($item_title, $item_content, $item_link);
//Add additional data to the current item if available
if(isset($item['item_updated']))
$feedWriter->set_date($item['item_updated'], DATE_UPDATED);
if(isset($item['item_published']))
$feedWriter->set_date($item['item_published'], DATE_PUBLISHED);
}
</pre><br />
<span class="c6"><br />
</span></div><div class="c4 c1"></div><ol class="c0" start="8"><li class="c3 c1"><b>Set the items array (section 1 of code block 3) to your data source, or leave the example array in place to continue and test the feed.</b></li>
<li class="c3 c1"><b>Update the Loop component (section 2 of code block 3) so that the array key values match your items array, or replace with your own values as required.</b></li>
</ol><div class="c5 c1"></div><div class="c11 c1"><span class="c2">Refer to the </span><span class="c2 c9"><a class="c10" href="http://phpfeedwriter.webmasterhub.net/docs/feedwriter/">FeedWriter Class Documentation</a></span><span class="c2"> for a list of functions that can be called to add additional information to feed items.</span></div><div class="c5 c1"></div><div class="c5 c1"></div><h4 class="c1"><a href="http://www.blogger.com/post-create.g?blogID=3808846106371591937" name="h.szz9r0gtpq7y"></a> </h4><h4 class="c1"><u>Get the specified feed output format</u></h4><div class="c1">The “feed.php” script that is being written in this example will take one query string (GET) parameter ”format”, that indicates which format to use when displaying the feed. If none is supplied, or the value supplied does not correspond to one of the supported formats, the default format (Atom 1.0) will be used. The formats that are supported by Php FeedWriter are: Atom 1.0, RSS 2.0, RSS 1.0, RSS 0.92 and RSS 0.91. </div><div class="c5 c1"></div><ol class="c0" start="10"><li class="c3 c1"><b>Paste the following code into your php file on an empty line after the code block added in the previous step.</b></li>
</ol><br />
<pre class="php" name="code">//Block 4 ----------------------------------------------
//Get the format to display in,
//set to RSS 2.0 as default or if format is not found
$format = Atom_1;
if(isset($_GET['format']) && $_GET['format'] != null)
{
foreach($feedWriter->getFeedFormats() as $curFormat)
{
if($curFormat[0] == $_GET['format'])
$format = $curFormat[1];
}
}
</pre><br />
<div class="c5 c1"></div><div class="c11 c1"><span class="c2">We are retrieving the feed format at this point to allow the output to be modified to allow HTML to be rendered when the feed is displayed. This can be done at any point in the script prior to calling the getXML() function to generate and display the feed. getXML() also has a default format if non is supplied, which is RSS 2.0.</span></div><div class="c4 c1"><span class="c2"></span></div><div class="c11 c1"><span class="c2">The loops through an array containing each of the supported format, and sets the output format for the feed if one matches the value passed to the “format” query string parameter.</span></div><div class="c4 c1"><span class="c2"></span></div><div class="c11 c1"><span class="c2">The default format can be changed by changing the ATOM_1 constant to another format. ($format = ATOM_1;). For a list of constants used by the class, see </span><span class="c2 c9"><a class="c10" href="http://phpfeedwriter.webmasterhub.net/docs/constants/">Php FeedWriter Constants</a></span><span class="c2">.</span></div><div class="c5 c1"></div><div class="c5 c1"><span class="c6"></span></div><h4 class="c1"><a href="http://www.blogger.com/post-create.g?blogID=3808846106371591937" name="h.5io9apsw3f6t"></a></h4><h4 class="c1"> </h4><h4 class="c1"><u>(Optional) Set the “Content” element of each feed item as type “HTML”</u></h4><div class="c5 c1"></div><ol class="c0" start="11"><li class="c3 c1"><b>Paste the following code into your Php file on an empty line after the code from the previous step.</b></li>
</ol><div class="c11 c1"><pre class="cpp" name="code">//Block 5 ----------------------------------------------
//Set the item body/content output type to html for the selected output format
$feedWriter->set_feedConstruct($format);
$feedWriter->feed_construct->construct['itemContent']['type'] = 'html';
</pre></div><div class="c5 c1"></div><div class="c11 c1"><span class="c2">This code adjusts the “Feed Construct” for the specified output format so that the “itemContent” element is set to type HTML. The Feed Construct is a class the builds a representation of a feed schema for use when validating and outputting a feed using Php FeedWriter. </span></div><div class="c4 c1"><span class="c2"></span></div><div class="c11 c1"><span class="c2">We first set the specific format using the </span><span class="c2 c9"><a class="c10" href="http://phpfeedwriter.webmasterhub.net/docs/feedwriter/set_feedconstruct/">set_feedConstruct()</a></span><span class="c2"> function. Once set, each “construct” from the specified output format can be accessed and modified using the </span><span class="c2 c9"><a class="c10" href="http://phpfeedwriter.webmasterhub.net/docs/feedconstruct/">FeedConstruct</a></span><span class="c2"> class functionality (a “construct” represents a single element in the XML schema of a feed format). The element/construct that we want to update is “itemContent”. </span></div><ul><li class="c8 c1"><span class="c2">For more information, and a full list of constructs for each format, see </span><span class="c2 c9"><a class="c10" href="http://phpfeedwriter.webmasterhub.net/docs/feedconstruct/predefined-constructs/">Predefined Feed Constructs</a></span><span class="c2">. </span></li>
<li class="c8 c1"><span class="c2">For a list of the abstracted values such as “itemContent” used to represent similar elements across multiple formats, see </span><span class="c2 c9"><a class="c10" href="http://phpfeedwriter.webmasterhub.net/docs/feedconstruct/commonname/">commonName Values</a></span><span class="c2">. </span></li>
</ul><ol class="c7" start="1"></ol><div class="c5 c1"></div><div class="c5 c1"></div><h4 class="c1"><a href="http://www.blogger.com/post-create.g?blogID=3808846106371591937" name="h.r2f6g6ewrpqz"></a> </h4><h4 class="c1"><u>Output the Feed XML</u></h4><div class="c1">The feed is outputted using the <a href="http://phpfeedwriter.webmasterhub.net/docs/feedwriter/getxml/">getXML() function</a>. The format is passed to the getXML() function as a parameter, which defines the output format. The value obtained earlier in the script will be passed to the function.</div><div class="c5 c1"></div><div class="c1">When validation is enabled, the getXML() function will validate the feed before outputting the XML. If the feed is not valid in the specified output format, a feed will be generated by Php FeedWriter containing information about why the feed was not valid. When debug is enabled, additional information is included about the specific components that were not valid. Both debug and validation can be disabled once you are happy with the feed to prevent this validation feed from displaying on a live website.</div><div class="c5 c1"></div><ol class="c0" start="12"><li class="c3 c1"><b>Copy the following code into the file after the block added in the previous step</b></li>
</ol><div class="c11 c1"><pre class="cpp" name="code">//Block 6 ----------------------------------------------
//Build and output the feed XML in the specified, or default format
//--------------------------------
echo $feedWriter->getXML($format);
</pre></div><div class="c4 c1"><span class="c6"></span></div><div class="c4 c1"><span class="c6"></span></div><h4 class="c1"><a href="http://www.blogger.com/post-create.g?blogID=3808846106371591937" name="h.hfpqa8u1c2f9"></a></h4><h4 class="c1"> </h4><h4 class="c1"><u>(Optional) Writing to a file / caching feed content</u></h4><div class="c1">It is also possible to write the output to a file for scenarios where the feed content should be cached, where the output file would be used to display the feed from your website instead of building the feed and generating the feed XML each time.</div><div class="c5 c1"></div><div class="c1">To write the feed output to a file, use the code below. Please ensure that you understand the security risks associated with allowing the web server to write files before attempting this on a public website. The code below would replace the block added in step 12 that includes the call to the getXML() function.</div><pre class="cpp" name="code">$feedWriter->writeToFile('filename.xml',$format);
</pre><br />
The Php FeedWriter website provides full documentation on the classes that make up the solution. Sample feed scripts are also available to download from the site.<br />
<br />
<hr /><b>View the feed created in this tutorial</b>: <a href="http://phpfeedwriter.webmasterhub.net/samples/1/feed.php">Atom 1.0</a>, <a href="http://phpfeedwriter.webmasterhub.net/samples/1/feed.php?format=RSS_2_0">RSS 2.0</a>, <a href="http://phpfeedwriter.webmasterhub.net/samples/1/feed.php?format=RSS_1_0">RSS 1.0</a>, <a href="http://phpfeedwriter.webmasterhub.net/samples/1/feed.php?format=RSS_0_92">RSS 0.92</a>, <a href="http://phpfeedwriter.webmasterhub.net/samples/1/feed.php?format=RSS_0_91">RSS 0.91</a>.<br />
<br />
<a href="http://phpfeedwriter.webmasterhub.net/samples/1/feed.zip"><b>Download the full Php script</b> created in this tutorial</a>.<br />
<br />
DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-76276773168762518982011-06-29T22:53:00.001+10:002011-06-29T22:54:34.833+10:00Php FeedWriter Released - Version 3.0 Beta - Universal Feed Generator<b>Generate Atom 1.0, RSS 2.0 and RSS 1.0 feeds for free using Php. </b><br />
<br />
<br />
<a href="http://phpfeedwriter.webmasterhub.net/"><b>Php FeedWriter 3.0 beta</b></a> has been released for download. The update to the class and functionality builds upon the previous version RSS2Writer v2.1, which limited output to an RSS 2.0 compatible feed only.<br />
Php FeedWriter 3.0 now <b>supports multiple feed formats</b>: Atom 1.0, RSS 2.0, RSS 1.0, RSS 0.92 and RSS 0.91. Php FeedWriter povides a set of easy to use functions to handle both feed input and output.<br />
<a name='more'></a><br />
<br />
<b>New FeedConstruct Class</b><br />
Php FeedWriter uses a custom "FeedConstruct" class to consttruct a representation of each supported feed output format. Specific elements that make up part of the XML document for a feed can be added and configured using the FeedConstruct class to control validation and XML output. This class is used as an <b>abstraction layer between each feed fomat</b> allowing data to be included in the feed once, but included in any of the output formats that support the data.<br />
<br />
<br />
<b>Online Documentation</b><br />
The Php FeedWriter website now provides <a href="http://phpfeedwriter.webmasterhub.net/docs">online documentation</a> supporting the solution. This includes doucmentation for each of the funtions in the FeedWriter and FeedConstruct class to assist when adding data into the feed, and for cases where you need to change or control how the data is outputted, such as using type "html" instead of "text" for the feed item body.<br />
<br />
<br />
Instructions for <a href="http://phpfeedwriter.webmasterhub.net/docs/installation/">how to install Php FeedWriter on a website</a> for first use are also provided. Tutorials for using php FeedWriter will be posted to the blog in future, which will also be accessible under the "Additional Resources" heading of the documentation page for a particular function.<br />
<br />
<b>Samples</b> <br />
A number of <a href="http://phpfeedwriter.webmasterhub.net/samples/">sample feed generator scripts</a> have been made available on the Php FeedWriter website to assist with creating a feed. Samples include single scripts that handle multiple feed formats, as well as preset (fixed) formats. Both simple and more extensive examples are provided. <br />
<br />
<br />
<b>Version 3 Beta Release</b><br />
Version 3.0 of Php FeedWriter has been released as a beta version to allow for more thorough testing to be completed and bugs/issues resolved prior to releasing a "stable" version. Version 3.0 beta has been successfully tested on a number of platforms to date, so is expected to be close to a "stable release". If you come accross a bug or unexpected behavior, including descrepencies between a feed generated by Php FeedWriter and the corresponding schema for the feed output format the details can be submitted to the bug Library. Before submitting a new bug, be sure to browse or search the existing bugs to ensure that someone else hasn't already submitted the same bug. Enhancements or suggestions for improvement can also be submitted to the Bug Library.<br />
<br />
For more information about this release, please see the related post on the Php FeedWriter blog: <a href="http://phpfeedwriter.webmasterhub.net/2011/06/php-feedwriter-3-0-beta-released/" title="Php FeedWriter 3.0 (beta) Released">Php FeedWriter 3.0 (beta) Released.</a><br />
<br />
<br />
<b>Universal Feed Generator</b><br />
Php FeedWriter can be viewed as a universal feed generator due to the <b>feed format abstraction</b> capabilities. There are currently a number of different formats supported by Php FeedWriter, which are configured using the FeedConstruct class.<br />
<br />
<br />
The FeedConstruct class also provides capabilities to be able to easily <b>integrate additional output formats</b> into the solution, or ammend the configuration of one of the existing "Predefined Feed Constructs" for a particular format.<br />
<br />
<br />
<b>Highly Compatible</b><br />
The <a href="http://phpfeedwriter.webmasterhub.net/about/supported-feed-formats/">output formats currently supported by Php Feedwriter</a> cover all formats used commonly on websites and by Feed Readers / Aggregators. This gives you the choice of allowing a more extensive feed to be generated from content on your website using a format such as Atom 1.0, but at the same time allow the feed to be generated in an older format sich as RSS 0.91 to maximise compatibility with feed readers.DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-3345360716656628642011-06-13T12:24:00.002+10:002011-06-13T12:29:51.884+10:00WordPress Breadcrumb Navigation on Pages & Meta TitleToday I needed to include page breadcrumbs on a WordPress blog site. I only wanted the breadcrumb navigation to be visible on pages, and to not display at all on the homepage (static).<br />
<a name='more'></a><br />
The following solution by Dimox was perfect for what I needed:<br />
<b><a href="http://dimox.net/wordpress-breadcrumbs-without-a-plugin/">WordPress Breadcrumbs Without a Plugin</a></b><br />
<br />
The solution was easy to implement and satisfied more than my initial requirements, so it gives me great pleasure to make a mention on my blog here.<br />
<br />
By default, the solution does not display the breadcrumb on the homepage, although this is easy to amend if required (see early comments). I placed the "short code" for the main function in only the page template so that the breadcrumb would not display on posts or category/search pages.<br />
<br />
As the solution worked so well, I decided to use to display a breadcrumb title. To do this, I first adjusted the dimox_breadcrums() function to include one parameter: ($meta_title = false)<br />
<br />
I then adjusted each part of the function that builds the breadcrumb to only include HTML output before and after each item in the breadcrumb ($before / $after) if the $meta_title variable is true. This meant that only the page title text and delimiter were included in the breadcrumb when $meta_title is true, allowing me to include in the title tag in the page meta data.<br />
<br />
To incorporate the breadcrumb into the title, I modified the header template for the theme that I was using, to include the following for the meta title:<br />
<br />
<br />
<title><?php bloginfo('name'); ?> » <?php if(is_page()) dimox_breadcrumbs(true); else wp_title(); ?> </title><br />
<br />
This meant that if a page, it would include the breadcrumb in the title overriding the default title, and include the default title when another type of page (post, search, category/tag, etc).DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com2tag:blogger.com,1999:blog-3808846106371591937.post-52796374760546138952011-02-13T01:56:00.002+11:002011-02-13T01:56:34.724+11:00Javascript Query String Manipulation Functions<span id="internal-source-marker_0.9555094028494423" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">Javascript Query String Manipulation Functions</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">The following is a series of articles with Javascript functions that can be used to manipulate the query string parameters and variables in the current url. Use the links below to go to a specific function:</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<a href="http://www.code-tips.com/2011/02/javascript-add-query-string-parameter.html"><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: underline; vertical-align: baseline;">Javascript Add Query String Parameter</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Add a query string parameter to the url of the current page.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<a href="http://www.code-tips.com/2011/02/javascript-check-if-query-string.html"><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: underline; vertical-align: baseline;">Javascript Check if Query String Parameter Exists in current URL</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Test if the query string of the current URL contains a specific parameter.</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<a href="http://www.code-tips.com/2011/02/javascript-remove-parameter-from-query.html"><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: underline; vertical-align: baseline;">Javascript Remove a parameter from the query string if found in current url</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Remove a parameter from the query string of the current page.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<a href="http://www.code-tips.com/2011/02/javascript-get-value-of-specified-query.html"><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: underline; vertical-align: baseline;">Javascript Get the value of the specified Query String Parameter</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Find the value of a specific query string parameter in the current URL. Return the value of the parameter, or false if not found.</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<a href="http://www.code-tips.com/2011/02/javascript-get-all-parameters-and.html"><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: underline; vertical-align: baseline;">Javascript Get all parameters and values as an Array</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Returns a multidimensional array containing parameters and values from the query string of the current page.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<a href="http://www.code-tips.com/2011/02/javascript-return-url-of-current-page.html"><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: underline; vertical-align: baseline;">Javascript Return the url of the current page with no query string parameters (strip params)</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Removes all parameters from the query string of the current URL.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><br />
<a href="http://www.code-tips.com/2011/02/javascript-add-query-string-parameter_13.html"><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: underline; vertical-align: baseline;">Javascript Add query string parameter dynamically to some or all links on the current page</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Update all links on the current page to include a specific query string parameter and value.</span>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-54227333493768974232011-02-13T01:01:00.004+11:002011-02-25T15:17:38.260+11:00Javascript Add query string parameter dynamically to some or all links on the current page<span id="internal-source-marker_0.9555094028494423" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">This Javascript function retrieves all <a> tags (hyperlinks) from the current page, and updates each link to include the supplied query string parameter and value.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">The third (optional) parameter passed to the function is an array of strings containing the domains that should be included when updating links on the page.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">If a link points to a domain that is not in the array passed to the function, the link will remain unchanged.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">If no Array of domains to include is supplied when calling the function, only the current domain is used. For each link on the current page that the function loops through, the query string parameter is added to the link if the host matches one of the hosts in the array of domains.</span><br />
<a name='more'></a><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">function updateLinks(parameter, value, includeDomainsArray)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">{</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> var links = document.getElementsByTagName('a');</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> var includeDomains = new Array();</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(arguments.length == 3) //has include domains</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Links will be updated only if they point to one of the following domains:</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //includeDomains = includeDomainsArray.split("|");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> includeDomains = includeDomainsArray;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> else</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Links will be updated only if they point to one the current domain only:</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> includeDomains[0] = self.location.host;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> for (var i=0;i<links.length;i++)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(links[i].href != "#" && links[i].href != "/" && links[i].href != "" && links[i].href != window.location) //Ignore links with empty src attribute, linking to site root, or anchor tags (#)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> var updateLink = false;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> for(k=0;k<includeDomains.length;k++)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(links[i].href.toLowerCase().indexOf(includeDomains[k].toLowerCase()) != -1) //Domain of current link is inlcluded i the includeDomains array. Update Required...</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> updateLink = true;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(!updateLink)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Do nothing - link not is includeDomains array</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> else</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> var queryStringComplete = "";</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> var paramCount = 0;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> var linkParts = links[i].href.split("?");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(linkParts.length > 1) // Has Query String Params</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = "?";</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> var fullQString = linkParts[1];</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> var paramArray = fullQString.split("&"); </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> var found = false;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> for (j=0;j<paramArray.length;j++)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> var currentParameter = paramArray[j].split("=");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(paramCount > 0)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = queryStringComplete + "&";</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(currentParameter[0] == parameter) //Parameter exists in url, refresh value</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = queryStringComplete + parameter + "=" + value;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> found = true;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> else</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = queryStringComplete + paramArray[j]; //Not related parameter - re-include in url</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> paramCount++;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(!found) //Add new param to end of query string</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = queryStringComplete + "&" + parameter + "=" + value;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> else</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = "?" + parameter + "=" + value;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> links[i].href = links[i].href.split("?")[0] + queryStringComplete; </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> else</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Do nothing - link not is includeDomains array</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">}</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Previous: </span><b></b><b><a href="http://www.code-tips.com/2011/02/javascript-return-url-of-current-page.html">Javascript Return the url of the current page with no query string parameters</a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span></b><br />
<b><br />
<br />
<a href="http://www.code-tips.com/2011/02/javascript-query-string-manipulation.html">Javascript Query String Manipulation</a> </b>(TOC)<b><br />
</b>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com1tag:blogger.com,1999:blog-3808846106371591937.post-52903576374425328942011-02-13T00:57:00.005+11:002011-02-13T02:01:54.235+11:00Javascript Return the url of the current page with no query string parameters<span id="internal-source-marker_0.9555094028494423" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">This Javascript function strips/removes any existing query string parameters from the url and returns the 'cleaned' url.</span><br />
<span id="internal-source-marker_0.9555094028494423" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><a name='more'></a> </span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">function stripParameters()</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">{</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> var loc = window.location.href;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> return loc.split("?")[0];</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">}</span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Next: </span><b><a href="http://www.code-tips.com/2011/02/javascript-add-query-string-parameter_13.html">Javascript Add query string parameter dynamically to some or all links on the current page</a></b><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Previous: </span><b><a href="http://www.code-tips.com/2011/02/javascript-get-all-parameters-and.html">Javascript Get all parameters and values as an Array</a></b><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><b><a href="http://www.code-tips.com/2011/02/javascript-query-string-manipulation.html">Javascript Query String Manipulation</a></b> (TOC)</span>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-88293362185020296722011-02-13T00:55:00.003+11:002011-02-25T15:05:36.500+11:00Javascript Get all parameters and values as an Array<span id="internal-source-marker_0.9555094028494423" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">This Javascript function extracts each parameter from the query string and returns a multi dimensional array containing the parameter names and values.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Array( Array(parameter_name1, parameter_value1) , Array(parameter_name2, parameter_value2) )</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<a name='more'></a><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">function getAllParameters()</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">{</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> fullQString = window.location.search.substring(1);</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> paramArray = fullQString.split("&");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> var finalArray = new Array();</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> for (i=0;i</span><span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><paramArray.length;i++)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> currentParameter = paramArray[i].split("=");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> finalArray[i] = Array(currentParameter[0], currentParameter[1]);</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> return finalArray;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">}</span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Next: </span><b><a href="http://www.code-tips.com/2011/02/javascript-return-url-of-current-page.html">Javascript Return the url of the current page with no query string parameters</a></b><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Previous: </span><a href="http://www.code-tips.com/2011/02/javascript-get-value-of-specified-query.html"><b>Javascript Get the value of the specified Query String Parameter</b></a><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><b><a href="http://www.code-tips.com/2011/02/javascript-query-string-manipulation.html">Javascript Query String Manipulation</a></b> (TOC)</span>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-37345681314363481532011-02-13T00:52:00.002+11:002011-02-25T15:05:12.287+11:00Javascript Get the value of the specified Query String Parameter<span id="internal-source-marker_0.9555094028494423" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">This Javascript function checks the address of the current page for the supplied query string parameter. If found, the value of the parameter is used, if the parameter is not found, false is returned.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">See also: </span><b><a href="http://www.code-tips.com/2011/02/javascript-check-if-query-string.html">checkParemeterExists()</a></b><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">, which returns true or false if the specified parameter is found or not.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><a name='more'></a> </span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">function getParameter(parameter)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">{</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> fullQString = window.location.search.substring(1);</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> paramArray = fullQString.split("&");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> found = false;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> for (i=0;i</span><span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><paramArray.length;i++)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> currentParameter = paramArray[i].split("=");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(currentParameter[0] == parameter)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> return currentParameter[1];</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> return false; //Not found</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">}</span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Next: </span><b><a href="http://www.code-tips.com/2011/02/javascript-get-all-parameters-and.html">Javascript Get all parameters and values as an Array</a></b><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Previous: </span><b><a href="http://www.code-tips.com/2011/02/javascript-remove-parameter-from-query.html">Javascript Remove a parameter from the query sring if found in current url</a></b><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><b><a href="http://www.code-tips.com/2011/02/javascript-query-string-manipulation.html">Javascript Query String Manipulation</a></b> (TOC)</span>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-8343593668520528812011-02-13T00:48:00.002+11:002011-02-25T15:04:53.923+11:00Javascript Remove a parameter from the query sring if found in current url<span id="internal-source-marker_0.9555094028494423" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">This Javascript function removes the supplied parameter from the query string if it is present in the current url. This is done by converting the query string into an array of parameters and values, then rebuilding the final string to exclude the parameter supplied to the function. The browser is then redirected to the current page with the new query string.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<a name='more'></a><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">function removeParameter(parameter)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">{</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Get Query String from url</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> fullQString = window.location.search.substring(1);</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> paramCount = 0;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = "?";</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(fullQString.length > 0)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Split Query String into separate parameters</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> paramArray = fullQString.split("&");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Loop through params, check if parameter exists. </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> for (i=0;i</span><span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><paramArray.length;i++)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> currentParameter = paramArray[i].split("=");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(currentParameter[0] == parameter) //Parameter already exists in current url</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //don't include existing (will be appended to end of url)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> else //Existing unrelated parameter</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(paramCount > 0)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = queryStringComplete + "&";</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = queryStringComplete + paramArray[i];</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> paramCount++;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> window.location = self.location.protocol + '//' + self.location.host + self.location.pathname + queryStringComplete;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">}</span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Next: </span><a href="http://www.code-tips.com/2011/02/javascript-get-value-of-specified-query.html"><b>Javascript Get the value of the specified Query String Parameter</b></a><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Previous: </span><a href="http://www.code-tips.com/2011/02/javascript-check-if-query-string.html"><b>Javascript Check if Query String Parameter Exists in current URL</b></a><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><a href="http://www.code-tips.com/2011/02/javascript-query-string-manipulation.html">Javascript Query String Manipulation</a> (TOC)</span>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-83503926982009833312011-02-13T00:45:00.002+11:002011-02-25T15:03:57.620+11:00Javascript Check if Query String Parameter Exists in current URL<span id="internal-source-marker_0.9555094028494423" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">This Javascript function checks if the parameter supplied exists in the query string.</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"> </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> If the parameter supplied is found in the query string of the current URL, the function will return true. If the parameter is not found, false is returned.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">See also:</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><a href="http://www.code-tips.com/2011/02/javascript-get-value-of-specified-query.html"><b>getParameter()</b></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> - This function returns the value of the parameter if found, and false if it is not found which can be used instead of the </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">checkParameterExists()</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> function below</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<a name='more'></a><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">function checkParemeterExists(parameter)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">{</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Get Query String from url</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> fullQString = window.location.search.substring(1);</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> paramCount = 0;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = "?";</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(fullQString.length > 0)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Split Query String into separate parameters</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> paramArray = fullQString.split("&");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Loop through params, check if parameter exists. </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> for (i=0;i</span><span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><paramArray.length;i++)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> currentParameter = paramArray[i].split("=");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(currentParameter[0] == parameter) //Parameter already exists in current url</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> return true;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> return false;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">}</span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Next: </span><a href="http://www.code-tips.com/2011/02/javascript-remove-parameter-from-query.html"><b>Javascript Remove a parameter from the query string if found in current url</b></a><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Previous: </span><b><a href="http://www.code-tips.com/2011/02/javascript-add-query-string-parameter.html">Javascript Add Query String Parameter</a></b><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><a href="http://www.code-tips.com/2011/02/javascript-query-string-manipulation.html"><b>Javascript Query String Manipulation</b></a> (TOC)</span>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com1tag:blogger.com,1999:blog-3808846106371591937.post-6016446450053661932011-02-13T00:40:00.003+11:002011-02-25T15:03:12.587+11:00Javascript Add Query String Parameter<span id="internal-source-marker_0.9555094028494423" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">Redirect to the current page including the specified query string parameter and value</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">This Javascript function redirects the browser back to the current page with the query string parameter data included that is passed to the function. If the current url already contains the supplied query string and value, no redirect will take place. Existing parameters and values are retained in the url after the redirect.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">This function can be useful when a common query string parameter is required across multiple pages on a site, such as a session hash/id or similar. </span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">The current page will reload to include the specified parameter and value if it doesn't already exist. Use this function in combination with the </span><b><a href="http://www.code-tips.com/2011/02/javascript-add-query-string-parameter_13.html">updateLinks()</a></b><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> function to add and manage query string parameters and variables across pages on a site dynamically.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<a name='more'></a><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">function addParameter(parameter, value)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">{</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Get Query String from url</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> fullQString = window.location.search.substring(1);</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> paramCount = 0;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = "?";</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(fullQString.length > 0)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Split Query String into separate parameters</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> paramArray = fullQString.split("&");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Loop through params, check if parameter exists. </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> for (i=0;i<paramArray.length;i++)<paramarray.length;i++)></paramarray.length;i++)></span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> currentParameter = paramArray[i].split("=");</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(currentParameter[0] == parameter) //Parameter already exists in current url</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //don't include existing (will be appended to end of url)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> else //Existing unrelated parameter</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> {</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(paramCount > 0)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = queryStringComplete + "&";</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = queryStringComplete + paramArray[i];</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> paramCount++;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> }</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> //Add/Update query string if required.</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> if(paramCount == 0)</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = queryStringComplete + parameter + "=" + value;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> else</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> queryStringComplete = queryStringComplete + "&" + parameter + "=" + value;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> window.location = self.location.protocol + '//' + self.location.host + self.location.pathname + queryStringComplete;</span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"> </span><br />
<span style="background-color: transparent; color: black; font-family: Courier New; font-size: 8pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">}</span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Next: </span><a href="http://www.code-tips.com/2011/02/javascript-check-if-query-string.html"><b>Javascript Check if Query String Parameter Exists in current URL</b></a><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><a href="http://www.code-tips.com/2011/02/javascript-query-string-manipulation.html">Javascript Query String Manipulation</a> (TOC)</span>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com1tag:blogger.com,1999:blog-3808846106371591937.post-35676330851445662882011-01-27T20:44:00.004+11:002011-01-27T20:55:25.710+11:00Outlook (2007) Ribbon: Issue adding new group to Message tab<span id="internal-source-marker_0.8461983903849148" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">When writing a </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">COM Addin for Microsoft Outlook 2007</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">, I came across a scenario where I needed to add buttons to the Ribbon when composing or reading an email message. Using the IRibbonExtensibility methods, I was able to add a new tab with groups and controls to the read and compose inspectors. The issue was that I needed to include an additional group in the Message tab of an email when composing or viewing. If I set the tab id to that of the read or compose message class (TabNewMailMessage or TabReadMessage), the group would not display at all.</span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">The new group would only display if added to a new tab. When I set the tab id to that of the Message tab for the read and compose message classes, the new group would not display at all. This was not ideal, as the solution required that the new group and buttons were displayed first before the standard groups within the Message Tab. </span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">There were a number of reasons that the custom group would not display in the Message tab on the Ribbon:</span><br />
<a name='more'></a><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">1. </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">I was using the id attribute instead of the idMso attribute for the tab. To reference the built-in Message tab, I needed to use the idMso attribute (idMso="TabNewMailMessage" or idMso="TabReadMessage", not id="TabNewMailMessage").</span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">2. </span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Include startFromScratch attribute in Ribbon element (startFromScratch="true"). When I first included the startFromScratch attribute set to true, I was referencing a different tab to the Message tab, so the result was that all tabs were removed except for my new tab and groups contained. After changing the id attribute to idMso and the value to the correct identifier for each Message class, my group was then added to the end of the built in Message tab. I then moved the new group to the beginning of the tab using the insertBeforeMso attribute and the built-in message class tag ids.</span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">The code used to add the new group to the Message tab is below. I first configure the button element to be added to the group, but a different button is added depending on the Message Class. The next step was to create the Custom Ribbon XML to include the other elements required to render the customisations, and add to a single string variable that includes the required button element. </span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">An alternative may be to read the entire XML file containing the new Ribbon elements from a file or application/addin resource. As I wanted to use the same tab, but have a different button be added depending on the message class, I chose to generate the custom ribbon XML using VB below.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<br />
<br />
<br />
(Note: Some lines of code may be spanned across multiple lines in the post. Copy to a text file to fix)<br />
<div style="font-family: "Courier New",Courier,monospace; font-size: x-small;">Public Function IRibbonExtensibility_GetCustomUI(ByVal RibbonID As String) As String<br />
<br />
Dim strXMLPath As String<br />
Dim strXMLOpen As String<br />
Dim strXMLClose As String<br />
Dim strXML As String<br />
Dim strIn As String<br />
Dim iFile As Integer<br />
Dim strBtnXML As String<br />
Dim strTabID As String<br />
Dim strInsertBeforeGroupID As String<br />
<br />
Select Case RibbonID<br />
Case "Microsoft.Outlook.Mail.Compose"<br />
' Return the RibbonX markup stored as a resource in the project<br />
strBtnXML = "<button id=""VBBtn1"" size=""large"" label=""New Button 1"" onAction=""cmdPressed1"" getSupertip=""getSuperTip"" getImage=""getImageDisplay"" />" & vbCrLf<br />
strTabID = "TabNewMailMessage"<br />
strInsertBeforeGroupID = "GroupClipboard"<br />
<br />
Case "Microsoft.Outlook.Mail.Read"<br />
' Return the RibbonX markup stored as a resource in the project<br />
strBtnXML = "<button id=""VBBtn2"" size=""large"" label=""New Button 2"" onAction=""cmdPressed2"" getSupertip=""getSuperTip"" getImage=""getImageDisplay"" />" & vbCrLf<br />
strTabID = "TabReadMessage"<br />
strInsertBeforeGroupID = "GroupShow"<br />
<br />
Case Else<br />
IRibbonExtensibility_GetCustomUI = ""<br />
Exit Function<br />
End Select<br />
<br />
strXMLOpen = "<?xml version=""1.0"" encoding=""utf-8"" ?>" & vbCrLf<br />
strXMLOpen = strXMLOpen & " <customUI xmlns = ""http://schemas.microsoft.com/office/2006/01/customui"" onLoad = ""Ribbon_OnLoad"" >" & vbCrLf<br />
strXMLOpen = strXMLOpen & " <ribbon startFromScratch=""true"">" & vbCrLf<br />
strXMLOpen = strXMLOpen & " <tabs>" & vbCrLf<br />
strXMLOpen = strXMLOpen & " <tab idMso=""" & strTabID & """ label=""Message"" visible=""true"" >" & vbCrLf<br />
strXMLOpen = strXMLOpen & " <group id=""GroupVBActions"" label=""" & ribbonGroupText & """ visible=""true"" insertBeforeMso=""" & strInsertBeforeGroupID & """ >" & vbCrLf<br />
<br />
strXMLClose = " </group>" & vbCrLf<br />
strXMLClose = strXMLClose & " </tab>" & vbCrLf<br />
strXMLClose = strXMLClose & " </tabs>" & vbCrLf<br />
strXMLClose = strXMLClose & " </ribbon>" & vbCrLf<br />
strXMLClose = strXMLClose & "</customUI>" & vbCrLf<br />
<br />
<br />
strXML = strXMLOpen & strBtnXML & strXMLClose<br />
<br />
IRibbonExtensibility_GetCustomUI = strXML<br />
<br />
End Function</div><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"><code here=""></code></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">The function stores XML data in separate strings. It first determines which button is required based on the Message class (reading or composing a message), the adds the button XML to the strBtnXML string variable.</span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">The remaining components of the XML are then added to the strXMLOpen and strXMLClose variables, and the complete XML constructed and stored in the strXML variable. Storing the separate components of the XML is not a requirement, as it is only configured this way to allow the XML contents to be represented in code in a readable manner.</span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">Resources:</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<ul><li style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><a href="http://msdn.microsoft.com/en-us/library/aa434079%28v=office.12%29.aspx"><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;">MSDN How to: Customize the Ribbon UI by using a Visual Basic COM Add-in</span></a><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span></li>
<li style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; list-style-type: disc; text-decoration: none; vertical-align: baseline;"><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">DevVB.com - </span><a href="http://www.devvb.com/"><span style="background-color: transparent; color: #000099; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: underline; vertical-align: baseline;">Visual Basic Development Resources</span></a></li>
</ul>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-81329899025902849492011-01-26T02:31:00.001+11:002011-01-26T02:43:18.639+11:00Outlook VBA Macro Cause Close LoopWhen developing a macro for Outlook 2007 Visual Basic Editor, part of the <b>macro code caused outlook to close unexpectedly (“Unexpected Error has occurred”)</b> while attempting to load. This meant that I was not able to easily access the macro to fix the issue.<br />
<br />
The article <a href="http://www.devvb.com/sp/7661-Outlook-Close-Loop-Macro-Development/">Outlook Close Loop - VB Macro Development</a> suggested to adjust the macro security check option via the registry to allow Outlook to open again. This worked, which allow Outlook to open without the error. When prompted to enable or disable macros while loading, I opted to disabled macros. This allowed Outlook to full load, and gave me access to the VB Editor to fix the issue.DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-66788837185025836312010-09-19T15:55:00.006+10:002010-09-28T00:59:32.155+10:00Web Development & SEO: Considerations / Gotchas when Outsourcing SEO ServicesWeb Development and online Marketing in the industry today often involves a large number of broad areas such as planning / BA, website or system design, system or application development, system testing., server configuration and maintenance, DNS configuration, Internet Marketing / SEO, etc. There are many cases where a developer will carried out similar tasks to the webmaster, SEO or internet marketing consultant, especially when the Web site is managed externally by a single company. Most companies and individuals who offer online services for the development of web sites may also need to configure and maintain the DNS and web server. Many developers become experienced in some of these areas, but to become a real expert in any given area requires a lifetime of knowledge and experience. This is often the deciding point between outsourcing website development and SEO services to an individual with lower prices, or a larger company higher prices, but have access to a much greater range of skills in each area. In business scenarios, outsourcing the company with a wide range of talent is required to get the site off the ground, and will generally be more worth while in the end in regards to return on investment.<br />
<a name='more'></a><br />
Professional SEO Consultants and Internet marketers should have at least moderate web development skills in order to optimize a website internally for search engines. This may require an understanding of multiple programming languages, data sources and business integration and reporting platforms. This can be one of the gotchas when <a href="http://www.webmasterhub.net/article/4-web-development-seo-outsourcing-seo-services-important-consi/" style="color: black; text-decoration: none;"><b>outsourcing SEO</b></a> or development, as there are many web development companies that will also claim to provide the necessary SEO services for you site or company. If a company claims to provide a "SEO Services" consist primarily of developers and not professional SEO, Advertising and Internet Marketing consultants where high quality content, language and marketing skills are their main focus, you may find that the techniques employed to market you site are not ethical or legal, and certainly not useful enough to serve it’s purpose of marketing another place on the internet. Many development companies use their development skills to create automated solutions for marketing a websites on the internet, which can seem attractive due to the number of external links being obtained, but is in most cases a complete waste of time and money.<br />
<br />
If your SEO company uses forums to create content to market your site, make sure that the forums related to your site, and that the marketing content added to forums is informative, useful, and not the sales pitch unless published in the appropriate area. For external content to be most successful, it should be useful and relevant in the context of the website it has been placed on.<br />
<br />
For example, you might feel as though you are getting great value for the purchase of 10 000 or similar links for low price. Chances are that each of the previous customers/clients also have a link to their website on the same 10,000 pages or sites, regardless of the purpose of each external web page or types of products / services being offered. Although the price seems cheap, it will most likely be a complete waste of time, since most major search engines choose to ignore spammy content, or content from spammy domains. If the site is useful and worth sharing with others, websites and publishers will naturally link to your web site to help you build backlinks. Another downfall with purchasing links in bulk is that Search Engines may notice the unnatural growth in external links to your site, which can result in being penalised or even banned. This, and many other similar techniques would be termed 'Black Hat' SEO that may work at the time of purchase, but technology and other emerging black hat techniques will eventually be recognized by major search engines making use the techniques useless, a waste of time and risk severely damaging the reputation of the website (and SEO company).<br />
<br />
The thing that catches most people, is that is pretty widely known that backlinks help promote websites in search engines. When you see an offer for 10,000 backlinks for a small price, it can seem to good to be true as to create 10,000 pages manually to link back to your site would be impossible to do in a short time with quality (non duplicate) content. Purchasing links in bulk will in most cases be completely useless in terms of affect on SERPs and return on investment. Although building backlinks is important to help expose a website to the Internet and in Search Results, for maximum success in the marketing campaign you need to think in terms of content as apposed to links. If the content is not useful in some way, or published to a location that is not trusted by other websites and search engines it won’t be much use. In the past I was much more successful with between 5 and 10 backlinks from pages with high quality original, and highly related content, as I have to thousands of links from sites and pages that are not closely associated with the primary purpose of your website. In my opinion you are not paying for the actual backlinks at all, but instead for the time necessary to create high quality and useful content that contains a link to your website. Paying for 10,000 backlinks may seem easy and cheap if compared with the amount of time required to create these links, but the process to create the links would be automated, taking less than a few hours to complete at worse. To get many links from high-quality content itself would take a very long time to complete and involve large costs. When outsourcing or purchasing links from companies that provide bulk links offers at small prices, high quality content is certainly not what you are paying for.<br />
<br />
This is not to say that all <a href="http://www.devcommunity.info/">Web Development / SEO</a> companies that use forums (or similar) to create backlinks from relevant content do so using spammy techniques. Many companies employ experienced content writers with the appropriate skills required to write high quality content relating to your website. High-quality marketing content on external websites will be most successful if engaging, useful and original in the context of the site or page the content is published on. Purchasing links from such content or paying professional writers themselves to create high quality content is much more expensive than buying a large number of generic links in bulk. In the past, I have found that hiring professional writers will always result in effective and useful marketing campaign, which yields results greater than that of links from generic, duplicate and spammy content. If you are hiring a professional writer, be sure to provide enough detail in the brief to ensure that the content produced is appropriate and written to target the required keywords and phrases in a non manipulative way. <br />
<br />
Further indication of the quality and professionalism of Internet Marketing SEO firm, is whether or not they are open to the techniques used to market your site. If information like this is withheld from you, then it's probably because they engage in unethical practices when promoting websites online. There are not many secrets of good SEO, which is why all of a well established professional SEO firms will certainly explain the process they go though to write and publish high quality content to trusted external sites. Some companies also offer SEO services, advising publishers and website owners to use techniques to continuously promote your website. Many also have a number of specialized forums, directories and Web sites that allow content to be added in the areas relevant to your site. This is most successful when actively participating on the forums in constructive ways that result in the threads being indexed and followed promptly by search engines.<br />
<br />
When planning to outsourcing SEO or Internet Marketing services to promote your website, the most important things to consider if money spent is likely to bring higher returns in the long run. Be sure to analyze your competitor sites and SERPs, and websites of the chosen SEO company's previous clients to determine what marketing techniques are used. Avoid taking short-cuts, such as purchasing large amounts of links, which can result in your site being penalised or excluded from search engines all together. You will generally get what you pay for, and be satisfied as long as you spend the time doing some research before handing over the money.DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com5tag:blogger.com,1999:blog-3808846106371591937.post-69687114539864865262010-09-13T20:23:00.004+10:002010-09-14T02:04:06.051+10:00User Acceptance of Innovations and new Solutions<span id="internal-source-marker_0.3330418752475297" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;"></span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">The following provides some things to consider when developing and implementing new solutions for large volumes of end users, with a primary focus on user acceptance. The information is my own personal opinion which is based on my experience as a Solution Architect and Developer. I have struggled on many occasions to have users accept and adopt a new system or process, and as a result now incorporate number of techniques and methods to assist with user acceptance when designing and developing a solution. Some of these would be common sense, but others are often overlooked as an important part of the planning, development, testing and implementation phases of a new innovation. The main focus is on some of the reasons for the non-acceptance of new solutions and some techniques to help improve level of user acceptance. This applies to the implementation of any new system or process for any large group of users, and is not dependent on the platform used to develop the solution.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<a name='more'></a><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">User Resistance Non-Acceptance</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Having users accept the use of new innovations in their day-to-day operations can sometimes be quite difficult. When dealing with larger number of end users, there will almost always be some resistance from users, particularly if they have a personal stake or authority within the business. Resistance may be caused by a number of reasons including the general lack of a technical understanding or abilities, as there will always be people who struggle with and avoid the use of technology and computers. Other reasons might be that a solution was introduced to replace an existing system and processes that people were comfortable and failure with. If the equivalent implementation of the existing system or process is not obviously easier and more efficient to use, as well as to provide some additional features or functionality users will be much less likely to adopt the new solution.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">Process Alignment</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">When planning to implement an innovation or new solution, it is important to analyse existing systems and processes, as well as to consult with actual end-users of existing systems and users of the proposed system. Ensuring that the implementation incorporates all functionality of the existing system will help with user adoption, as users will already be failure with the system and how it works. On the other hand, if similar functionality is replicated in the new solution, but the interface and/or process is completely different, users may struggle to adopt the change.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">Champions</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">In most small or large organisations, there are a number of people who actively seek out better and more efficient ways to do their day-to-day work and in many cases the work of others. Many of these individuals would be referred to as Champions of the business, as they possess the confidence required to suggest something new that has not been implemented or considered in the past, or to make suggestions for changes to be made to existing systems or processes. Champions are very valuable to a business, as they can nurture change into a business by instigating and promoting cultural change within an organisation. Champions would have a firm understanding of the day-to-day operations of their own, and other colleagues roles. Working closely with such people when designing and developing a system can help ensure that it provides the necessary functionality in an interface that is user friendly. Once implemented, the champion will have a solid understanding of the functionality and how to use the system. As they came forward with the idea or concept in the first place, they will also feel and most likely have some sort of ownership over the idea within the business. As feel as though they are partially responsible for the system being implemented, they will almost always hold others' hands during the initial stages after implementation and can also provide training to others in how to use the system.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">Solution Architecture & Developer Resource Management</span><span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Although it might be great for people to be thinking proactively about how to improve their day-to-day operations or efficiency, it can also result in development time and resources being wasted if a system is not adopted after being implemented. This is more likely to happen if a person has not consulted others for a advise or second opinion in relation to their idea or concept. There are many cases where someone has a seemingly great idea, then after weeks of development the idea is implemented as a technical solution. The user who made the initial request is delighted to see the results of their idea implemented as a solution, but others may struggle to see the same benefits. In some instances, the requester will have a play with their new 'toy' for a few hours or days if your lucky, only to push it aside after the initial excitement has passed and resume the use of previous systems and processed. You should always weigh up the pros and cons of a new implementation, considering the amount of development that is required to build the system. Some small visual or functional enhancements may take days or weeks to develop, but provide no or minimal additional benefit overall. Part of the role of a solution architect or developer during the planning phase should be to evaluate if the investment of development resources is likely to be money or time well spent. There are often other alternatives available that will also satisfy requirements of a request. In many cases, there would be much more efficient ways to achieve a similar result, but a compromise may have to be made to make it possible to implement a solution without wasting time and resources. Usually after carefully explaining how an alternative and more practical method (in terms of development time and resources) can be used to turn their request into a solution, they are happy customers. A demonstration using similar functionality implemented elsewhere may be required, as it also helps the person with the idea see how it could come together.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">System, User Interface and User Acceptance Testing (UAT)</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">To further increase the chances of user acceptance for a solution developed using SharePoint or another platform, you should aim to and build a user interface that is intuitive and easy to navigate. If users are able to use the solution without requiring training, they are also much more likely to use and continue to use the system. When developing an interface, it can be hard to put yourself in the shoes of the end users as you would already have a much deeper understanding of the system introducing bias. When you are certain that your interface is as easy and straight forward to use as it gets, think twice. There will most likely be users that will interpret the interface different to yourself and others, particularly when there are icons or buttons used with symbolic graphics describing their function. A good way to make sure that the interface is indeed intuitive and easy to use is to take a sample of end users who have no previous knowledge of the details of the solution, and to have them work through the processed and functionality using the interface provided. You will soon know if the interface requires adjustment, or if it is logical and satisfactory to the sample users. This is also a good way to find any issues, and to have others provide unbiased feedback about the interface, functionality and overall solution. If the group of sample users is larger, the results will provide a more accurate gauge of the solution’s success. If the sample group doesn’t represent the full group of end users, bias and other external factors can be introduced that will skew the results or feedback. This may be caused by different levels of computer skills required for people in different roles. A more extreme example would be selecting other developers as the sample test group for the new interface or solution. Generally speaking, a developer, or anyone with a deeper understanding of computers and technology will interpret an interface differently than someone without the same skill level, who would be more likely to struggle. Having the opinion or input from other developers is certainly valuable, but it is still essential to design and test the user interface and functionality of the solution with end users. </span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">There are formal procedures that can be followed when performing User Acceptance Testing to help ensure all aspects of the system are covered. </span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">Summary</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">There are many contributing factors to why the may be resistance from users when adopting a new solution or process. Careful planning, as well as consultation with the end users of a system is essential in order to develop a solution that will satisfy the needs of the end users. Testing the system and user interface on a sample group of users is important to obtain feedback about the system and interface prior to implementation. When a the user interface of a system is simple, intuitive and easy to use, the level of user acceptance will be much greater.</span>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-68077726733908968212010-09-13T00:37:00.000+10:002010-09-13T10:47:12.351+10:00Optimise Database & Application Scripts for Performance - Web DevelopmentImproving the performance of a Web Application or website can sometimes be difficult depending on the factors that are contributing to downgraded performance. In some cases, performance issues may be related to server hardware or network issues to limitations which would usually cost money to improve. In other cases, there are many factors that can impact on the overall performance of a web application or website that can be changed easily.<br />
<a name='more'></a><br />
When a database is used to store data that is required by an application to function or display information to end-users, it is sometimes hard to know exactly how it should be developed before the system has deen in production. It will be much easier once a system is in production to see what works well and what doesn't, but it is too late by this stage as making major structural shanges to a database and schema with existing data will be difficult, time consuming or not possible at all without having to re-build some components from scratch. <br />
<br />
To prevent having to completely re-work a datanase schema ofter it has been developed an incorporated into a live application, you need to have a strong understanding of the goals and objectives of the system, major components / processes and their primary function, as well as how each component and process pull together technically. This will allow a database schema to be designed that caters for all of the intended data types, using appropriate primary and secondary keys on each table to allow associated data form different to be joined logically. Understanding the application as a whole will also help to indicate what DBMS would be appropriate to satisfy all requirements of the system, as well as to provide sufficient security measures to keep the database and data safe.<br />
<br />
<a href="http://www.webmasterhub.net/article/2-web-development-fine-tuning-databases-schema-and-scripts-to-/">Improving the performance of an application or website</a> that is already in production can be achived by analysing traffic and usage data, as well as database statistics to determine which areas are more frequently used and if there are database queries that are slow, impacting on the overall performance of the application. Finding the specific scripts that are causing components of the application to function slowly and working to improve programming logic and database queries on these is a good start, but time is best spent working in areas that are also frequently used when in production. There is not much pojnt in optimising a script, database table and/or query if it it only saves a few seconds of loading time and the page is only accessed once a month or so.<br />
<br />
Optimising the hompage of a website on the other hand would in most cases be time better spent, as the volume of users is generally greater, resulting in a more significant improvement in the overall performance of the application. Finding a ballance, between pages / database queries that are slow and pages or scripts that are most frequently requested/executed will help to improve the performance in problem areas first, which will result in the most significant increase in overall performance.<br />
<br />
<a href="http://www.code-tips.com/2009/12/improve-performance-for-websites-with.html">Improve Performance for Websites with a Database Back-end & Dynamic Content</a>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-62029689415504579232010-09-13T00:05:00.000+10:002010-09-13T00:05:33.623+10:00Text in textarea chopped off after quote or apostrophe<span id="internal-source-marker_0.16017254262142622" style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">I had an issue, where the text in a textarea input was being cut off after a quote or apostrophe. The form was submitting to a ‘confirm’ mode, which displayed the details entered into the form back to the user for confirmation. The details were being passed between each page/mode using hidden fields. I found that if there was a quote or apostrophe in the text entered into the textarea field, it would be chopped of once the data had been submitted, or if pressing the ‘modify’ button on the confirm page. After having a look at the page source of the confirm page, I noticed that the value from the textarea field which was being stored in a hidden variable spanned across multiple lines in the code. As the value of the hidden text field was wrapped in quotation marks, the result was that the parser would stop think that the textarea content had finished. As the content spanned across multiple lines, the parser would resume rendering the page content even though it was still within the text inside the hidden field value.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">I tried a few things with limited success, including removing all line breaks from the text so that is it rendered on one line as well as encoding the quotation marks when including as an attribute value, but the solution I used was to store the value from the textarea field in a hidden textarea field on the confirm page instead of a hidden input field type. I used the display attribute (display: none) to hide the text area from being displayed on the page.</span>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-69293952028521866772010-09-08T23:48:00.001+10:002010-09-08T23:53:00.503+10:00SharePoint Development at a Higher Level<b>SharePoint development</b> may be required to provide an environment that is custom to a business as well as to enable additional features and integrate with existing and new technologies. Many companies provide consulting services for SharePoint, allowing an understanding to be gained on the capabilities of the core features provided by SharePoint, and how they can be utilised or developed to build solutions for the business. <b>Custom SharePoint Development</b> may include anything from the construction of an intranet environment to the development of complex workflow involving many people within the business, that may also draw from a range of existing sources for data such as project reporting or accounting systems.<br />
<a name='more'></a><br />
An Intranet environment would generally have appropriate team sites created for each division or team within the business, including document management tools, team communication and collaboration, task and resource management, security, etc. Document repositories with version control and approval workflow can allow business documentation, forms and form templates to be maintained, distributed and controlled securely from a central or many locations.<br />
<br />
Once configured and secured on the network of a business, SharePoint provides a large range of easy to use features for creating and configuring sites, groups and permissions, individual lists & libraries such as calendars, tasks, discussions and document/form libraries and basic workflow. With sufficient permission to a site collection, new sites, workspaces and site components can be created and maintained easily using the list / site settings & other components of the web interface provided by SharePoint.<br />
<br />
Some organisations may require custom SharePoint development to build solutions that automate existing processes within the business to improve efficiency and reduce the chance of human error. This may even include the development of a web facing form for clients/customers that can be placed on an extranet that would also be powered by SharePoint, and could interact with other internal portals and site collections used by the business.<br />
<br />
SharePoint provides a range of predefined workflows that can be applied and configured on lists / document libraries on a SharePoint site. No SharePoint development is required to configure or use these workflows, as the process is configurable using the browser. In most cases, the approval workflow provided by SharePoint will be the most commonly used, as it allows documents, files and content to be maintained by all or a set of users, but changes need to be approved by an authorised person before they will become available to others.<br />
<br />
SharePoint Designer also provides functionality to <b>build workflow and develop in SharePoint</b>, allowing greater control over the process and number of options available without needing to use code. Other third party workflow tools also exist to help ease the process of creating workflow in SharePoint, as well as making it possible for a general SharePoint user to understand and build workflow instead of a SharePoint Developer.<br />
<br />
In many cases, the core features provided by SharePoint and SharePoint Designer will not be suitable for, or capable of being used to build solutions in SharePoint. This is where a SharePoint consultant or solution architect may be required to <b>help design a solution that will best suit the needs of the business</b>. Companies providing SharePoint consultancy services can, and will generally assist with each of the planning, design, development an implementation phases of a SharePoint implementation, or the development of various solution for the business using or utilising SharePoint.<br />
<br />
Find <b><a href="http://www.devsharepoint.com/">SharePoint Development</a> resources</b>, including resources for SharePoint developers and a collection of companies providing SharePoint Development services. Stay up to date with SharePoint development news and resources, or simply learn more about SharePoint and it's capabilities using the range of resources provided by DevSharePoint.com.DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-64235421084763783432010-08-31T20:30:00.001+10:002011-09-16T18:13:30.428+10:00Php RSS 2 Writer Update (v2.1) - CDATA EnabledThe <b>Php RSS 2.0 Writer class</b> has been recently updated to include the option of writing <b>CDATA</b> in the RSS feed item title or description components. This allows the feed to be parsed even when the content within a feed item contains special characters that would usually be parsed as an XML element, such as HTML code. When the xml parser reaches a CDATA tag, the content within will be ignored, allowing special characters to be included in the content. Please note that you are still required to encode any special character that appears in a CDATA tag, which is commonly '<', '>' and '&' characters.<br />
<br />
View more details about the update and the <b><a href="http://www.code-tips.com/2010/01/php-rss2writer-v20-generate-rss-20-feed.html">Php RSS 2 Writer</a></b> class file. Further information is also available ablut the recent updates to the class as well as general usage information for the class. The class file and sample constructor is also available for downloaded on this page.<br />
<br />
The CDATA update was prompted by an issue someone was having when trying to generate an RSS Feed using the class. View the <a href="http://www.code-tips.com/2010/08/rss-feed-cdata-troubleshooting.html">RSS Feed CDATA Troubleshooting</a> post.<br />
<br />
[Update: The Php RSS 2.0 Writer class that this post refers to has been upgraded, and has also moved to a dedicated site. The updated package is now Php FeedWriter, which supports output of multiple RSS formats and also Atom 1.0. A tutorial is available on this blog to help with: <b><a href="http://www.code-tips.com/2011/08/how-to-generate-feed-using-php-atom-10.html">Creating a custom feed using Php FeedWriter</a></b>. A link to download the package for free is available from the post also. ]DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-39176928016859655172010-08-31T18:35:00.001+10:002010-08-31T18:36:43.683+10:00C# Generate Random String of a Specific Length<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">The following function will generate a random string of the supplied length. The function uses the Random object to generate random integer values that correspond to ASCII values within a specific range (a-z, 0-9). Once a random string has been generated that is the required length, it is then returned.</span><br />
<a name='more'></a><br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">This can be useful if you are wanting to generate a unique code or id for use in a .NET application, or anything that supports C#. For example, this could be used as an security code for authentication via links in an email. The security code would be unique, and not be included in an email to more than one person. The code can then be used to determine who clicked a link in an email by finding the user who corresponds to the unique code.</span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;">Another use may be for general logging/reporting of links clicked in an email to know who clicked a link when other tracking mechanisms are not available. As the email address would need to be know to be able to send an email to the user, it is possible to have a unique code associated with every email that is distributed.</span><br />
<br />
<br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: normal; text-decoration: none; vertical-align: baseline;"></span><br />
<span style="background-color: transparent; color: black; font-family: Arial; font-size: 11pt; font-style: normal; font-weight: bold; text-decoration: none; vertical-align: baseline;">C#:</span><br />
<div style="font-size:8pt;"><pre>public String generateRandomString(int length) {
<span style="color: #38761d;">//Initiate objects & vars</span> Random random = new Random();
String randomString = "";
int randNumber;
<span style="color: #38761d;">//Loop ‘length’ times to generate a random number or character</span>
for (int i = 0; i < length; i++) {
if (random.Next(1, 3) == 1)
randNumber = random.Next(97, 123); //char {a-z}
else
randNumber = random.Next(48, 58); //int {0-9}
<span style="color: #38761d;">//append random char or digit to random string</span>
randomString = randomString + (char)randNumber;
}
<span style="color: #6aa84f;">//return the random string</span>
return randomString;</pre><pre>}</pre><pre></pre></div>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com4tag:blogger.com,1999:blog-3808846106371591937.post-10489144100805298202010-08-30T01:05:00.002+10:002010-08-30T01:32:36.816+10:00Windows Phone 7 Development ResourcesThe following page lists some good <b>Windows Phone 7 Development</b> articles and resources: Local database support for Windows Phone 7, Windows Phone 7 SDK, SharePoint & Windows Phone 7, <b>Windows Phone 7 Development Training</b>, Developer Tools and much more.<br />
<br />
See: <b><a href="http://www.devcommunity.info/category/windows+phone/">Windows Phone 7 Development</a></b>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-21184440048853863772010-08-25T20:47:00.009+10:002011-09-16T18:15:24.783+10:00RSS Feed CDATA Troubleshooting<span style="font-weight: bold;">RSS2Writer v2.1 has been updated to v3.0 beta. The new version can be downloaded at the Php FeedWriter website: <a href="http://phpfeedwriter.webmasterhub.net/">http://PhpFeedWriter.WebmasterHub.net/</a> </span><br />
<br />
<b>Php FeedWriter (v3.0 beta)</b> now provides the ability to output to various feed formats. Php FeedWriter can currently <b>generate Atom 1.0, RSS 2.0, RSS 1.0, RSS 0.92 and RSS 0.91 compatible feeds</b>. <br />
<br />
View more information about <a href="http://phpfeedwriter.webmasterhub.net/">Php FeedWriter</a>, including <b>online documentation</b>. For information about the latest update and release, see the article <b><a href="http://phpfeedwriter.webmasterhub.net/2011/06/php-feedwriter-3-0-beta-released/" title="Php FeedWriter 3.0 (beta) Released">Php FeedWriter 3.0 (beta) Released</a></b>.<br />
<br />
A tutorial demonstrating how to build a feed using Php FeedWriter is also available on this blog:<br />
<b><a href="http://www.code-tips.com/2011/08/how-to-generate-feed-using-php-atom-10.html">How to Generate Feed Using Php (Atom 1.0 and RSS 2.0 Compatible)</a></b><br />
<br />
<hr /><br />
RSS Feed CDATA was not working properly in the Php RSS 2.0 Writer class when trying to generate an RSS feed, as CDATA was not initially supported by the class. When the CDATA tags were included using '<![CDATA[' . $content . ']]>' as the value in the description element of the field, it didn't work.<br />
<a name='more'></a><br />
Some of the things considered were the RSS feed reader being used to test the feed and if it supported the use of CDATA in an RSS feed, and if special characters were being encoded properly. The intention was to allow content which would usually be parsed as and xml element to be ignored by the parser and included as characters (CDATA). This applies to a range of characters, but more commonly &,<,>, etc. used in html/xml markup.<br />
<br />
<hr /><br />
<span style="font-family: "Times New Roman","serif"; font-size: 12pt;">Abdul Basit (</span>abasit83<span style="font-family: "Times New Roman","serif"; font-size: 12pt;">) was able to fix the issue by including content in the xml element using the <b>writeCData(...)</b> method provided by the XMLWriter class.</span><br />
<span style="font-family: "Times New Roman","serif"; font-size: 12pt;"><br />
</span><br />
<span style="font-family: "Times New Roman","serif"; font-size: 12pt;">View details about the </span><a href="http://www.code-tips.com/2010/01/php-rss2writer-v20-generate-rss-20-feed.html">Php RSS 2.0 Writer</a> class that was being used, and more information about the CDATA mods.<br />
<br />
The following resources provide some information about using CDATA in RSS feeds, and XML in general:<br />
· <a href="http://xml.silmaril.ie/authors/cdata/">C.28 When should I use a CDATA Marked Section?</a><br />
· <a href="http://seamframework.org/Community/CDATAAndFormattedTextInRSSXML">CDATA and formattedText in RSS XML</a><br />
· <a href="http://www.sitepoint.com/forums/showthread.php?t=570490">RSS CData Item</a>DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0tag:blogger.com,1999:blog-3808846106371591937.post-63813888698290977132010-08-16T22:34:00.002+10:002010-08-27T20:32:33.129+10:00InfoPath SharePoint Development<a href="http://www.devsharepoint.com/" target="_blank"><b>SharePoint News & Development Resources</b></a><br />
DevSharePoint.com provides the latest SharePoint news and resources. Stay up to date with SharePoint 2010, MOSS 2007, WSS, SharePoint Designer (2007/2010), InfoPath. <br />
<br />
<a href="http://www.infopathsharepoint.net/" target="_blank"><b>InfoPath & SharePoint Development Tutorials, Resources & How To's</b></a><br />
InfoPathSharePoint.net provides the latest InfoPath development tutorials, InfoPath Form Services administration tips, tricks and how to's. InfoPath SharePoint Integration: Integrate InfoPath Forms with SharePoint lists, libraries & workflow. <br />
<br />
<a href="http://www.sharepoint-infopath.com/" target="_blank"><b>SharePoint & InfoPath News & Resources</b></a> <br />
SharePoint Administration, Development, Design & Customization Resources from around the internet. SharePoint & InfoPath News. InfoPath SharePoint Integration. InfoPath Form Template Design. InfoPath Form layouts, design tips & techniques.DanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.com0