When duplicating a Wordpress page, it breaks and looks different - php

I tried duplicating a page in Wordpress in order to translate it for local users in different countries, but for some reason, even though it's the exact same page (it even looks the same inside wordpress preview) it just breaks and looks different (seems like a css problem of some sort, probably?)
The "nice" website is:
www.blaqkdesign.com/?noredirect=true
The one i'm having problem with:
www.blaqkdesign.com/mx/?noredirect=true
Side note: "noredirect" is the command used in order to bypass IP redirection
Any ideas on what could be happening? Thanks in advance!

I found that the second one missing of themify-builder-4534-generated.css?ver=17.09.19.04.52.54, it should be named themify-builder-2534-generated.css?ver=17.09.19.04.52.54
Difference is 4534 should be 2543, please try to change if possible.

Related

Wordpress Fields getting swapped when having specific values

This is a strange one, but it seems like it should be really easy to solve.
I have a wordpress website Version 4.8.3. PHP 5.6.32.
Whenever I put in a specific value into the title field 6147989800 (or other fields) it get's swapped out on the front end with 8552226270.
I searched in every file on the server for some code (i suspect javascript) that is swapping out the numbers. No luck.
When I search the database the original number 6147989800 is there. But when I do a var_dump of the field is shows 8552226270 and it shows up as 8552226270 on the front end.
This switch happens when I put in 6147989800, 614.798.9800, and 614-798-9800.
I'm at a loss. Even stranger is that when I duplicate the website to a local instance and on a test server the swap doesn't happen.
Any ideas would be great. Thanks!
Thank you John Ellmore for your help. It did end up being a third party Javascript that was doing the phone swap.
I don't know how I missed it [smacks palm against forehead]

How to compare strings based on caracters similarity in SQL?

I'm working on redirecting people if they type a "not really wrong url".
For example I have a good URL http://www.website.com/category/foo-bar-if-bar-foo/.
This one works so if a user enter to my website with it, I can retrieve the article corresponding.
But if someone enter to my website with a not really wrong url like http://www.website.com/category/foo-bar-foo/ because an another website has referenced a wrong url, I should redirect him to the right one instead of having a 404 status code...
So how should I do this? and Most important, should I do this ?
I actually use Eloquent with Laravel 4.2.
Thank you in advance.
EDIT
I was wrong about stackoverflow, thanks for your comment. It uses the unique ID of a post.
EDIT 2
I Looked at SOUNDEX function in SQL, it's really good if there is a small difference like a character or two missing. But if my url is as broken as my example, it's not working anymore obviously. But thanks it's gonna be usefull.
Just thinking off the top of my head, you could create a SQL table (with Full-Text indexing enabled) containing all your paths (it might already exist).
In the event that a 404 is triggered, hijack that and do a MATCH (Full Text Search) and return the path with the highest scoring MATCH (you can also consider using a score threshold to prevent nonsensical matches).

ModX revo 2.2x: How to use a TV value to set tpl?

I'm trying to figure out a way to render a resource with a specific tpl based on a template variable(tv) value. here is my use case:
I have setup a modx installation for a basic site with a homepage and a blog (I used the articles add-on). I want to display blog posts on the home page, outside of the articles container. From my experience the easiest way to do this is with getResource. However for this specific project I would like to change the tpl of the getResources results based on whatever the tv value is for each result.
The template variable can be looked at as a "post type". if you choose "text" it would have tplA, if you choose "multimedia" it would have tplB etc...
now based on my research you would use the properties 'tplCondition' and 'conditionalTpls' to achieve this in your getResources call, something like this:
[[getResources?
&tplCondition=`tv.blogPostType`
&conditionalTpls=`{"1":"tplA","2":"tplB","3":"tplC"}`
&tpl=`defaultTpl`
]]
The problem is, this does not seem to work with template variables :( it even says it only uses resource fields in the documentation.....which is a REAL bummer, as i have no idea to pull this off otherwise. Based on my limited knowledge, you can maybe create a snippet or something that does this, But i have no clue.
Does anyone have an elegant solution to this problem?
to sum up what im trying to do, again:
-assign a "post type" to blog posts in my articles container via template variable.
-use the template variable value to set a specific tpl based on that value.
any help is highly appreciated. thanks
EDIT: okay I got a reply on the forums and have come across a"solution" to this.
you can accomplish this with css. in the tpl, you do something like:
<article class="[[+tv.post-type]]">....</article>
this will output the post type selected in the tv as the actual element class used, and you can then use css to give the output different looks based on the tv. its actually so simple im a little embarrased i didnt see it before. In my situation it 100% solves my problem, however if you needed to chasnge html im guessing javascript would need to be involved or another method with php. just leaving this here in case someone needs it!
If you need to do major changes to the html you could still probably solve it with css if you have a nice markup. However if thats not enough i would solve it by using one tpl for the getresources call, and letting that tpl handle the switching. If you could have your TV output the value symbolize the name of the tpl that should be used in each case, your tpl would only need this:
[[$[[+tv.yourtv]]]]
Your tv will be evaluated first, and then it will be processed as a chunk. That way you dont need a nasty switch or if-clause.
This is assumin you want toally different tpls, and not just need to change some small part of the standard tpl, in that case you could still use this tecnique though!
Conditional templates seem to work fine with pdoResources (part of pdoTools). (I have to put "tv." in front of the TV in the tplCondition but not in the other TVs)
James is correct.
[[pdoResources?
&includeTVs=`blogPostType`
&tplCondition=`tv.blogPostType`
&conditionalTpls=`{"1":"tplA","2":"tplB","3":"tplC"}`
&tpl=`defaultTpl`
]]

Using $_SERVER['HTTP_REFERER'] With GET Variables

I'm using PHP and I'd like to create an if statement that does something if the user came to the current page from the home page. So far, I've been using this code:
if(!in_array($_SERVER['HTTP_REFERER'], $validHomes){
//do something}
The array $validHomes contains a couple different variations of index.php (without .php, without www.)
This has been working fine but now I'd like the home page to have a GET variable sometimes which will have different values: www.example.com/index?var=5. $_SERVER['HTTP_REFERER'] treats URLs with GET variables that have different values as different from each other so I'm wondering if anyone has a suggestion for how to get around this? How can I trigger the if statement for a wide range of index URLs that contain GET variables with different values?
Thanks a lot for any help.
It would be better to add a GET parameter from your home page links and check for that parameter instead. This would be far simpler and more reliable.
Another option would be to use stristr($_SERVER['HTTP_REFERER'], 'index');
Though Matt's answer is indeed more reliable.

J-locate on joomla platform

I created an external link for J-locate plugin for Joomla that would help show a certain locations I need on the map since there is no way to set a default location through the plugin. It goes something like this: view=jlocate&state=nc&zip=27604&radius=10
I am trying to figure out a way to get rid of the state filter so it doesn't restrict the zipcodes closest location by the states. Is it possible to put multiple states in the external link I made? It would be nice if it works so it filters through all states, i tried putting something like the following: view=jlocate&state=nc&ca&fl&zip=27604&radius=10 so it would go through multiple states but it only selects the first one, so if the zipcode is not in NC, it wouldn't find it.
My goal is to make the map available so anyone can search all states by the zipcode field alone without putting in a state. This will resolve a border line locations that i am facing right now due to the fact that its filtering states.
Thank you in advance for any positive help.
here is the link to the plugin i am using: http://joomlavida.com/jlocate-joomla-store-locator-demo?zip=33761&state=FL
It really depends on the component.
The correct way to pass a list could be an array
&state[]=nc&state[]=va&state[]=nj
but since you want to do without, why not omit it? If it's forced somewhere beyond your control you could still unset() it.
Otherwise in the unlikely scenario that the programmer is not doing server-side sql injection filtering, pass
&state=%
where % is the wildcard for SQL.

Categories