Search

I'm afraid not no, this isn't supported in the Symphony core so isn't implemented by SymQL. What are you trying to achieve?

@joaobarbosa: you can try the database sections view extension:

http://getsymphony.com/download/extensions/view/81111/

You can performe a SELECT DISTINCT over the views generated for this extension.

Maybe a wierd question but can this plugin replace this xslt so I can use a DS for it ?

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:import href="../utilities/master.xsl"/>
<xsl:import href="../utilities/dagboek-article.xsl"/>

<xsl:param name="total_articles" select="data/dagboek/pagination/@total-entries" />

<xsl:param name="articles_per_page">
    <xsl:choose>
        <xsl:when test="$page = 1 and $year = 2005 and $month = 04">1</xsl:when>
        <xsl:when test="$page = 1 and $year = 2005 and $month = 07">2</xsl:when>
        <xsl:when test="$page &gt;= 1 and $page &lt;= 4 and $year = 2005 and $month= 09">1</xsl:when>
        <xsl:when test="$page &gt;= 5 and $page &lt;= 7 and $year = 2005 and $month= 09">2</xsl:when>
        <xsl:when test="$page = 1 and $year = 2006 and $month=07">2</xsl:when>
        <xsl:when test="$page &gt; 7 and $year = 2005 and $month = 09">3</xsl:when>
        <xsl:when test="$year = 2007 and $month=06">1</xsl:when>
        <xsl:otherwise>4</xsl:otherwise>
    </xsl:choose>
</xsl:param>

<xsl:param name="number_pages">
    <xsl:choose>
        <xsl:when test="$year = 2005 and $month = 04">3</xsl:when>
        <xsl:when test="$year = 2005 and $month = 08">4</xsl:when>
        <xsl:when test="$year = 2005 and $month = 09">11</xsl:when>
        <xsl:when test="$year = 2006 and $month = 07">2</xsl:when>
        <xsl:otherwise>
           <xsl:value-of select="ceiling($total_articles div $articles_per_page)" />
        </xsl:otherwise>
    </xsl:choose>
</xsl:param>

<xsl:param name="offset">
    <xsl:choose>
        <xsl:when test="$page = 1 and $year = 2005 and $month = 04">0</xsl:when>
        <xsl:when test="$page &gt; 1 and $year = 2005 and $month= 04"> <xsl:value-of select="($page - 1)* $articles_per_page - 3" /> </xsl:when>
        <xsl:when test="$page &gt; 1 and $year = 2005 and $month= 08"> <xsl:value-of select="($page - 1)* $articles_per_page - 2" /> </xsl:when>
        <xsl:when test="$page &gt;= 1 and $page &lt;= 4 and $year = 2005 and $month= 09"> <xsl:value-of select = "$page -1" /> </xsl:when>
         <xsl:when test="$page &gt;= 5 and $page &lt;= 7 and $year = 2005 and $month= 09"> <xsl:value-of select = "($page -1)* $articles_per_page - 4" /> </xsl:when>
         <xsl:when test="$page &gt; 7  and $year=2005 and $month = 09"> <xsl:value-of select = "($page -1)* $articles_per_page - 13" /> </xsl:when>
           <xsl:when test="$page = 1 and $year = 2006 and $month = 07">0</xsl:when>
            <xsl:when test="$page = 2 and $year = 2006 and $month = 07">2</xsl:when>
        <xsl:otherwise>
           <xsl:value-of select="$articles_per_page * $page  - $articles_per_page " />
        </xsl:otherwise>
    </xsl:choose>
</xsl:param>

<xsl:param name="end" select="$offset + $articles_per_page + 1" />

<xsl:template match="data">
<xsl:if test="$page &lt;= $number_pages" >
       <xsl:apply-templates select="dagboek/entry[position() &gt; $offset and position() &lt; $end]
 " />
</xsl:if>
<xsl:if test="$page &gt; $number_pages">
   <xsl:call-template name="error" />
</xsl:if>

<xsl:if test="$number_pages &gt; 1">
   <div class="post-nav">
          <xsl:if test=" $page &gt; 1" >
               <span class="previous"><a href="{$root}/dagboek/{$year}/{$month}/{$page - 1}"></a>

          </span>
          </xsl:if>
        <xsl:if test="$page &lt; $number_pages" > 
           <span class="next"><a href="{$root}/dagboek/{$year}/{$month}/{$page + 1}"></a></span>
        </xsl:if>
</div>
</xsl:if>


</xsl:template>


</xsl:stylesheet>

Maybe a wierd question but can this plugin replace this xslt so I can use a DS for it ?

I'm not sure SymQL will help you here. I think the best idea is to start a new clean thread and ask for specific information on what you are trying to achieve or refine.

As soon as I use a second "where" with "SymQL::DSFILTEROR", the number for "total-entries" in the pagination get's totally messed up.

I think this might even be a bug in the core (EntryManager or whatever), because I tried a different solution to my problem with Union Datasource instead of using SymQL in a custom datasource, and it also returned a wrong number for "total-entries".

Any ideas?

@guillem_l the extension is pretty cool, but didn't work with select box link field :(

@nickdunn I've got this situation:

Section Jobs [id] [name]

Section Part Type [id] [name]

Section Part [id] [name] [job ( select box link )] [type ( select box link )]

I need to get the jobs which has parts of an specific type, and a job can has many parts, so, just querying the parts of a specific type, I've got the same job more than once in the result.

I've made it querying all parts and filtering it manually inside de DS, but this solution doesn't work so good when using pagination...

Ah, so a job can have multiple [arts using the same part type (e.g. Job A has three Part entries, all referring to the same Part Type)? If this is the case, then I think the Database Section Views might work (I haven't used it), or you should query the database directly.

It seems odd to me that you can have multiple Part entries with the same Job (id) and Part Type (id), but then I don't fully understand the context of your problem. It seems as though it's a bit like a shopping cart, but if it were then you'd never get two or more entries in Parts with the same Job and Part Type.

Can anyone confirm that symql works in symphony version 2.2.5? I'm getting the following if I try any query:

Fatal error: Using $this when not in object context in /home/scionfts/public_html/symphony/lib/toolkit/class.sectionmanager.php on line 151

This goes away if I remove the query. Below is the query I'm trying to perform:

         $query = new SymQLQuery();
        $query
            ->select('requested-username')
            ->from('vpn-accounts')
            ->where('id', $log['txn_id']);
         $result = SymQL::run($query);
         $requestedUsername = $result->getValue();
         echo $requestedUsername;

It work fine in 2.2.5, how about replace "echo" with "print_r" or remove the lines contain "echo" to confirm if the result is non-string datatype?

Works in 2.2.5.

Works in 2.2.5 and 2.3 too. Perhaps you're trying to select a field type from an extension?

Thanks all for the quick replies

how about replace "echo" with "print_r" or remove the lines contain "echo" to confirm if the result is non-string datatype?

it happens even without a call to print_r or echo.

Perhaps you're trying to select a field type from an extension?

the 'requested_username' field is a Username field (from the 'Members' extension). Is this to be expected? Does Symql only query native field types?

Like to confirm if there any difference 'requested-username' and 'requested_username' mentioned in both of your posts?

'vpn-acount' (table) in your query is located in which database?

@proyb: Sorry that was a typo. The correct field name is 'requested-username'. 'vpn-account' is a normal symphony section that contains the 'requested-username' field.

Basically what I want to do is get the value of the 'requested-username' field (which is a 'Members User' field type) in the 'vpn-account' section who's id matches the number specified in $log['txn_id']. Perhaps something is wrong with my query?

Currently, the query is being done from inside a custom datasource filter (for testing purposes). However, in the end, I would like to have this query performed during a custom event. Does context matter? Can symql only be used in certain contexts (for example during the execution of a custom data source)? If this is the case, how would I approach querying the db during the execution of a custom event?

I'm still not familiar with Event. It will be best to remove ->where('id', $log['txn_id']); and hopefully it able to find the whole list of rows.

If that work, then $log['txn_id'] could be the issue.

Last solution is to try on fresh Symphony installation with only member extension and see if the error is reproducible.

the 'requested_username' field is a Username field (from the 'Members' extension). Is this to be expected? Does Symql only query native field types?

No, most field types are supported, but the Members fields are very specialised so they might need additional massaging to work with SymQL.

However the error you're getting looks odd because it is occurring when trying to create a Section object, prior to instantiating any fields at all.

Can symql only be used in certain contexts (for example during the execution of a custom data source)?

No, should work in any context. It was originally devised for use in completely standalone scripts.

Nick, the latest codebase does not work on 2.2.5: Class Extension_SymQL contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Extension::about)

No big deal, I thought, I will just checkout the older branch, but there is only the master branch.

I prefer not to checkout to a specific commit (for updating reasons), so is there a possibility of creating a seperate "cutting edge" branch?

Well, I think it is updated for Sym 2.3. Grab v0.6.2.

Ah, thanks, I missed the tags.

So did I yesterday.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details