We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

{url_title_path=''}, {url} and {url_title} are Not Working

How Do I?

typohannes's avatar
typohannes
14 posts
6 years ago
typohannes's avatar typohannes

Hi,

So I’ve upgraded from v3.5.17 to 4.3.8, the upgrade went well, there were no issue during the process, however, when I viewed the site front-end I got this error.

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY c.group_id, c.parent_id, c.cat_order' at line 7:
SELECT c.cat_name, c.cat_url_title, c.cat_id, c.cat_image, c.cat_description, c.parent_id, p.cat_id, p.entry_id, c.group_id , cg.field_html_formatting, fd.* FROM (exp_categories AS c, exp_category_posts AS p) LEFT JOIN exp_category_field_data AS fd ON fd.cat_id = c.cat_id LEFT JOIN exp_category_groups AS cg ON cg.group_id = c.group_id WHERE c.cat_id = p.cat_id AND p.entry_id IN () ORDER BY c.group_id, c.parent_id, c.cat_order

ee/legacy/database/drivers/mysqli/mysqli_connection.php:116
Stack Trace: Please include when reporting this error

    #0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(111): CI_DB_mysqli_connection->query('SELECT c.cat_na...')
    #1 ee/legacy/database/DB_driver.php(269): CI_DB_mysqli_driver->_execute('SELECT c.cat_na...')
    #2 ee/legacy/database/DB_driver.php(179): CI_DB_driver->simple_query('SELECT c.cat_na...')
    #3 ee/EllisLab/Addons/channel/mod.channel.php(471): CI_DB_driver->query('SELECT c.cat_na...')
    #4 ee/EllisLab/Addons/channel/mod.channel.php(286): Channel->fetch_categories()
    #5 ee/legacy/libraries/Template.php(1843): Channel->entries()
    #6 ee/legacy/libraries/Template.php(1478): EE_Template->process_tags()
    #7 ee/legacy/libraries/Template.php(574): EE_Template->tags()
    #8 ee/legacy/libraries/Template.php(231): EE_Template->parse('{!-- ra:0000000...', false, 4, false)
    #9 ee/legacy/libraries/Template.php(164): EE_Template->fetch_and_parse('', Array, false)
    #10 ee/legacy/libraries/Core.php(670): EE_Template->run_template_engine('', '')
    #11 ee/legacy/controllers/ee.php(62): EE_Core->generate_page()
    #12 [internal function]: EE->index()
    #13 ee/EllisLab/ExpressionEngine/Core/Core.php(240): call_user_func_array(Array, Array)
    #14 ee/EllisLab/ExpressionEngine/Core/Core.php(109): EllisLab\ExpressionEngine\Core\Core->runController(Array)
    #15 ee/EllisLab/ExpressionEngine/Boot/boot.php(146): EllisLab\ExpressionEngine\Core\Core->run(Object(EllisLab\ExpressionEngine\Core\Request))
    #16 index.php(175): require_once('...')
    #16 index.php(175): require_once('...')

I’ve checked the template and noticed that it was something with this tag {url_title_path=''} and {url_title} which added under a Channel loop when I removed the Tag, the site work just fine.

E.g. code below

{exp:channel:entries channel="portfolio" limit="9" sort="desc" cache="no" refresh="30"}
  {url_title_path='portfolio'}
{/exp:channel:entries}

However, this one is working fine {title_permalink}

I really need it to work so I can come up with something like

<a href="http://{url}#{url_title}" target="_blank" rel="noopener">{url}#{url_title}</a>

Even inline CSS is not possible and throw the same SQL Error. [it trimmed any attribute so I added it outside of span instead]

<span> "position: relative; top: 0.15em; padding-right: 0.6em; font-size: 1.4em;"
...
</span>

Do you have any idea?

Thanks

       
Rob Allen's avatar
Rob Allen
2,950 posts
6 years ago
Rob Allen's avatar Rob Allen

I take it you need the hash symbol in your URL’s? If so try {site_url}#{url_title}

       
typohannes's avatar
typohannes
14 posts
about 6 years ago
typohannes's avatar typohannes

Hello Rob,

Thanks for the reply, I’d like to but as you can see on my post the {url_title} didn’t work either.

Thanks

       
JCOGS Design's avatar
JCOGS Design
71 posts
about 6 years ago
JCOGS Design's avatar JCOGS Design

{url_title_path} expects you to specify a template. Given the way template groups work this usually means you specify a template group and a template name in the tag using the form {url_title_path='channel/archives'}. In the example you give you only have a single term, so it might be you can fix the issue by changing your tag to have both group and template name.

Alternatively, if this is for a specific template / path you can construct your URL using the {site_url}global system variable - something like

<a href="http://{site_url}/group/template/{url_title}" rel="noopener noopener" target="_blank">Link Text</a>

HTH

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.