i have responsive template, its have 3 php files : - templatedesktop.php : template file for desktop - templatemobile.php : template file for mobile - page.php : contain information content, its included templatedesktop.php & templatemobile.php file inside now i need to hide some part inside page.php, that should hide from mobile version, and appeared in desktop version only i already tried add this define code inside templatedesktop.php file : and wrap some part that want to hide but its not working, maybe its should do the opposite, please help what is the right if conditional/methode? like request, referer or other
First of, I don't understand why the responsive template needs to include two files for different purposes at the same time - I don't even understand how this works - how does it discern what to show from templatemobile and templatedesktop at any given time? This sounds like a very hacked-together solution. Second: if this works as I assume it should work, why can't you just add the content you need to display for desktop only in the templatedesktop file?
its responsive, its can detect visitors using desktop or mobile & select which template file will used because the content need to hide is inside page.php file, and the template is in different files, templatedesktop.php and templatemobile.php there is should be a php conditional to do this, which one to do this http://php.net/manual/en/reserved.variables.server.php
Have you tried just using a variable? $isdesktop = true; if ($isdesktop) { //Show desktop stuff } PHP: Have you tried echoing THIS_SCRIPT to see if it is defined in different places of your script? Anyways, you would probably be much better off using CSS media queries as described here https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries Then you can hide or show different parts of the page depending on screen size. Just do display:none; to hide a div for example.
The solution used is incredibly stupid. Depending on what it utilizes to check what kind of browser the user have, it will break at some point. What exactly does the different template-files contain? To me, the whole setup reeks of incompetent developers. Sorry to say it, but the solution provided for a non-existing problem is horribly bad.
The implementations I have seen do this via user agent which is never going to be a perfect solution. Something like mobiledetect.net can be used for this but I would never use it for site layouts. It may be an option to present targeted advertising or something similar.
I've seen this particular bit of asshattery returning from the 1990's (like every other bit of stupidity) in part because Google's webmaster tools/suggestions is now advocating it in their utter and complete ignorance and newly found scam artist bullshit of trying to make you build a crappy page so you 'need' their pageSpeed "service". (which has been doing a stellar job of "servicing" people in the same way a bunk-mate in prison would) Let's call this what it is as this type of mouth-breathing dumbass nonsense is NOT RESPONSIVE DESIGN -- IT'S BROWSER SNIFFING. THE ENTIRE POINT of responsive design is to have ONE UNIFIED MARKUP and then use media queries to change the layout! (Playing to the original intent of HTML and why it exists, one markup for ALL possible device capabilities and combinations!) If you are using different markup, it's not responsive! Do not pass start, do not collect. If you need to have two different PHP includes just for a "responsive" design, you don't know what responsive layout is, much less how to build one! Which probably means you don't grasp accessibility minimums, elastic semi-fluid design, separation of presentation from content, when not to use pointless scripttardery, or any of the dozens of stepping stones one should have traveled BEFORE even THINKING about responsive design.