<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>davinci’s notebook &#187; mashup</title>
	<atom:link href="http://stargrads.net/blogs/davinci/tag/mashup/feed/" rel="self" type="application/rss+xml" />
	<link>http://stargrads.net/blogs/davinci</link>
	<description>everything is an experiment</description>
	<lastBuildDate>Mon, 21 Mar 2011 18:31:14 +0000</lastBuildDate>
	<language>fa</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Using the Ajaxified Expand Post Now plug-in with Rob Miller&#8217;s Footnotes plug-in</title>
		<link>http://stargrads.net/blogs/davinci/2009/08/using-the-ajaxified-expand-post-now-plugin-with-rob-millers-footnotes-plugin/</link>
		<comments>http://stargrads.net/blogs/davinci/2009/08/using-the-ajaxified-expand-post-now-plugin-with-rob-millers-footnotes-plugin/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 04:38:27 +0000</pubDate>
		<dc:creator>davinci</dc:creator>
				<category><![CDATA[★grads.net]]></category>
		<category><![CDATA[programming and technical issues]]></category>
		<category><![CDATA[AEPN]]></category>
		<category><![CDATA[Ajaxified Expand Post NOW]]></category>
		<category><![CDATA[Footnotes]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[mashup]]></category>
		<category><![CDATA[plug-ins]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[Rob Miller]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://stargrads.net/blogs/davinci/?p=1077</guid>
		<description><![CDATA[
A technical post on how to use the Ajaxified Expand Post NOW plug-in and Rob Miller's Footnotes plug-in for WordPress together.
]]></description>
			<content:encoded><![CDATA[<p>This is a little technical post for anyone who is interested in using the Ajaxified Expand Post NOW plug-in<sup><a class='footnote' id='note-1077-1' href='#footnote-1077-aepn'>[1]</a></sup> and Rob Miller&#8217;s Footnotes plug-in<sup><a class='footnote' id='note-1077-2' href='#footnote-1077-footnotes'>[2]</a></sup> together.  On <a href="http://stargrads.net">this</a> website, I&#8217;m running AEPN version 0.7 beta 7, Footnotes version 1.2.1, and WordPress<sup>&mu;</sup> version 2.8.2, which are the latest versions as of this writing.  </p>
<p>The AEPN plug-in truncates a post and appends an<span id="more-1077"></span> &#8220;[Expand post]&#8221; button, whenever it is displayed other than on a single page by itself.  Clicking on the button fetches and displays the rest of the post.  The Footnotes plug-in should be self-explanatory.</p>
<p>The problem with using these two plug-ins together is that if any citations are made before the fold (i.e., the <code>&lt;!--more--&gt;</code> tag), the corresponding footnotes will appear at the bottom of the (collapsed) post.  When the post is subsequently expanded, those footnotes will appear again at the end of the expansion, so that they are displayed twice.</p>
<p>The fix for this is rather simple.  In the &#8220;footnotes.php&#8221; file, surround the final if-else block with a test to see if a single post is being displayed.  If so, execute the block as before.  Otherwise, return the post&#8217;s content without the accompanying footer.  The code should look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> is_single<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>	
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&amp;lt;references /&amp;gt;'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$footer</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">else</span>
        <span style="color: #b1b100;">return</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;lt;references /&amp;gt;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$footer</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>When the AEPN plug-in fetches a post to expand it, it is treated as a single post, and so the footnotes will show up correctly &#8212; once, at the bottom of the expansion.</p>
<p>In the &#8220;ajaxified-expand-post-now.php&#8221; file, add the following lines to the top of the &#8220;getPost&#8221; function:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$post</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>ID <span style="color: #339933;">=</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span></pre></div></div>

<p>This is needed so that the names for the footnote anchors in the expanded portion of the post are generated correctly.  Citations made before the fold will link to the post&#8217;s single page, whereas citations made after it<sup><a class='footnote' id='note-1077-3' href='#footnote-1077-example'>[3]</a></sup> will link to the footnotes section at the bottom of the expansion, on the current page.</p>
<p>Finally, it may be necessary to use a so-called &#8220;<a href="http://mu.wordpress.org/forums/tags/kses">kses</a> hack&#8221; to prevent the &#8220;ref&#8221; and &#8220;references&#8221; tags needed by the Footnotes plug-in from being stripped by WordPress<sup>&mu;</sup>.  How to do this is beyond the scope of this post.</p>
<p>See also <a href="http://stargrads.net/blogs/davinci/2009/06/using-jsmath-with-wordpress-bbpress-and-wikindx/">this previous post</a> for an example of how the Footnotes plug-in can be used with the <a href="http://wikindx.sourceforge.net/"><span style="font-variant: small-caps">Wikindx</span></a> bibliographical management system to create a bibliographical citation. </p>
<p>&#8211; davinci</p>
<img src="http://stargrads.net/blogs/davinci/?ak_action=api_record_view&id=1077&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://stargrads.net/blogs/davinci/2009/09/wikindx-macro-plug-in-for-wordpress/' rel='bookmark' title='Wikindx macro plug-in for WordPress'>Wikindx macro plug-in for WordPress</a></li>
<li><a href='http://stargrads.net/blogs/davinci/2009/09/annotate-with-jarnal-plug-in-module-for-wikindx/' rel='bookmark' title='Annotate With Jarnal Plug-In Module for Wikindx'>Annotate With Jarnal Plug-In Module for Wikindx</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://stargrads.net/blogs/davinci/2009/08/using-the-ajaxified-expand-post-now-plugin-with-rob-millers-footnotes-plugin/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Using jsMath with WordPress, bbPress, and Wikindx</title>
		<link>http://stargrads.net/blogs/davinci/2009/06/using-jsmath-with-wordpress-bbpress-and-wikindx/</link>
		<comments>http://stargrads.net/blogs/davinci/2009/06/using-jsmath-with-wordpress-bbpress-and-wikindx/#comments</comments>
		<pubDate>Sat, 20 Jun 2009 18:27:57 +0000</pubDate>
		<dc:creator>davinci</dc:creator>
				<category><![CDATA[★grads.net]]></category>
		<category><![CDATA[programming and technical issues]]></category>
		<category><![CDATA[bbPress]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[jsMath]]></category>
		<category><![CDATA[mashup]]></category>
		<category><![CDATA[WIKINDX]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://stargrads.net/blogs/davinci/?p=867</guid>
		<description><![CDATA[
This post describes how to integrate jsMath with WordPress, bbPress, and Wikindx.
]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s really no special trick to using <a href="http://www.math.union.edu/~dpvc/jsMath/">jsMath</a> with <a href="http://wordpress.org/">WordPress</a>, <a href="http://bbpress.org/">bbPress</a>, or <a href="http://wikindx.sourceforge.net/"><span style="font-variant: small-caps">Wikindx</span></a> &#8212; just follow the <a href="http://www.math.union.edu/~dpvc/jsMath/authors/installation.html">installation instructions</a>.</p>
<p>Essentially, you just need to add the following code in the header of your web site (where &ldquo;<em>path.to</em>&rdquo; should be replaced with the URL to your installation of jsMath):</p>
<blockquote><p>&lt;script type=&quot;text/javascript&quot; src=&quot;http://<em>path.to</em>/jsMath/easy/load.js&quot;&gt;&lt;/script&gt;</p></blockquote>
<p>For <a href="http://stargrads.net"><em>this</em> web site</a>, the above line was added to the headers of each of the template files of the component software packages.  </p>
<p>One <em>minor</em> trick to getting jsMath to work with <span style="font-variant: small-caps">Wikindx</span> is that all special characters have to be escaped properly\(\)<span id="more-867"></span>.  For example, to get the title of Mario Szegedy&#8217;s paper<sup><a class='footnote' id='note-867-1' href='#footnote-867-S04'>[1]</a></sup> on quantum walks to display correctly, as seen <a href="http://stargrads.net/bibliography/index.php?action=resourceView&amp;id=194">here</a>, I had to enter the title as:</p>
<blockquote><p>Spectra of Quantized Walks and a \$\sqrt{{}\delta\epsilon{}}\$-Rule</p></blockquote>
<p>That is, where the LaTeX math syntax requires a left curly bracket, you enter &#8220;{{}&#8221;, and where it requires a right curly bracket, you enter &#8220;{}}&#8221;.  The title then appears as in the footnote below.</p>
<p>I have created a <a href="http://stargrads.net/wiki/Help:Setup">setup help page</a> on the wiki to record details such as these.  Also, see <a href="http://stargrads.net/forums/topic.php?id=3">this forum post</a> for some macros defined for use on this site.</p>
<p>&#8211; davinci</p>
<img src="http://stargrads.net/blogs/davinci/?ak_action=api_record_view&id=867&type=feed" alt="" /><p>Related posts:<ol>
<li><a href='http://stargrads.net/blogs/davinci/2009/09/wikindx-macro-plug-in-for-wordpress/' rel='bookmark' title='Wikindx macro plug-in for WordPress'>Wikindx macro plug-in for WordPress</a></li>
<li><a href='http://stargrads.net/blogs/davinci/2009/08/using-the-ajaxified-expand-post-now-plugin-with-rob-millers-footnotes-plugin/' rel='bookmark' title='Using the Ajaxified Expand Post Now plug-in with Rob Miller&#8217;s Footnotes plug-in'>Using the Ajaxified Expand Post Now plug-in with Rob Miller&#8217;s Footnotes plug-in</a></li>
<li><a href='http://stargrads.net/blogs/davinci/2009/09/annotate-with-jarnal-plug-in-module-for-wikindx/' rel='bookmark' title='Annotate With Jarnal Plug-In Module for Wikindx'>Annotate With Jarnal Plug-In Module for Wikindx</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://stargrads.net/blogs/davinci/2009/06/using-jsmath-with-wordpress-bbpress-and-wikindx/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

