How to access modules from mura tag in content - mura

I'd like to access the modules directory in /themes/[themename]/modules instead of /sites/default/themes/[themename]/modules/ from [mura]-tag in content
This is Mura Core Version 7.1.438
[mura]dspInclude('themes/[themename]/modules/sprachweiche.cfm')[/mura]
Error 500
Could not find the included template /muraWRM/sites/default/themes/[themename]/modules/sprachweiche.cfm.

To display a registered module, simply use the following syntax, and pass in the directory name of your module.
[m]$.dspObject(object='your-module-directory-name-goes-here')[/m]
That said, in your example though, it doesn't appear to be a valid "module", since you're attempting to include a file called sprachweiche.cfm. So, if you simply want to include a file, I wouldn't put it under the modules directory. So, if you have a directory under your theme called includes, you could use this instead:
[m]$.dspThemeInclude('includes/sprachweiche.cfm')[/m]
This method automatically generates the path to your theme, so you can simply pass in the rest of the path to your desired file.
Cheers!

Thanks Steve
[m]$.dspThemeInclude('includes/sprachweiche.cfm')[/m] caused the error:
Could not find the included template /muraWRM/themes/[themename]/includes/sprachweiche.cfm.
But including the modules directory to the path works:
[m]$.dspThemeInclude('modules/includes/sprachweiche.cfm')[/m]

Related

Eclipse Build Variables Relative to Path Variables

My project has external resource files linked to a folder on my computer. In order to change them easily when moving the project to another location or another PC, I defined a Path Variable called LIBRARY_LOC by going into:
Properties/Resource/Linked Resources/Path Variables.
Now I am able to add a file by going into:
New/File/Advanced/Link to file in the file system/Variables/LIBRARY_LOC
Then complete the relative link as:
LIBRARY_LOC\utility\some_file.c
So I can add an externally linked file using the relative location defined as LIBRARY_LOC.
Everything works fine for now.
Now I also need to add Include Paths using LIBRARY_LOC into Tool Settings/GCC Compiler/Include paths
So I tried this:
${LIBRARY_LOC}/Utilities/sequencer
or this:
${env_var:LIBRARY_LOC}/Utilities/sequencer
or this:
LIBRARY_LOC/Utilities/sequencer
But none of them worked. The only way to achieve this is to define a Build Variable with a different name but pointing to the same location. Let's say LIBRARY_PATH. Then I can use this in Include Paths as below:
"{LIBRARY_PATH}/Utilities/sequencer
Now I am able to do what I want, I have relative paths for both adding externally linked files and include paths but when I move the project, I will need to change two different variables defined in Path Variables and Build Variables but in fact, they both point to the same location.
I tried referencing each other while defining them but it didn't work either. If it could work, I could at least change only one of them but keep the other as it would be defined as a relative to the other.

How to find the "current" source file in Python 3?

What's the simplest way to find the path to the file in which I am "executing" some code? By this, I mean that if I have a file foo.py that contains:
print(here())
I would like to see /some/path/foo.py (I realise that in practice what file is "being executed" is complicated, but I think the above is well defined - a source file that contains some function that, when executed, gives the path to said file).
I have needed this in the past to make tests (that require some external file) self-contained, and I am currently wondering if it would be a useful way to locate some support files needed by a program. But I have never found a good way of doing this. The inspect module sounds like it should work, but you seem to need a class or function that is defined in that module.
In particular, the module instances contain __file__ attributes, but I can't see how to get the "current" module. Objects have a __module__ attribute, but that's the module name, not a module instance.
I guess one way is to throw and catch an exception and inspect the contents, but that seems like hard work. Surely there is a simple, easy way that I have missed?
To get the absolute path of the current file:
import os
os.path.abspath(__file__)
To get content of external file distributed with your package you could use pkg_util.get_data()(stdlib) or pkg_resources.resouce_string() (setuptools) to support execution from zip-archives or standalone executables created by py2exe, PyInstaller or similar, example.

file path problem

I am working on the dll project which contain 3 module.All these module include comman header file.I have the include folder path like mf/cv/include.now In the property dialog box I have give the path in c/c++>>general>>additional inclde Directories like .,..\include,..\cv\include in all the 3 module. I the 2 module its work perfectely,but in the last module fatal error occur that
fatal error C1083: Cannot open include file: 'abc.h': No such file or
directory
So I am not not able to understand what the problem in the path bacause this path work for all the module expect one.
(By 3 modules, I assume you mean 3 projects. If you meant 3 C++ files, you shouldn't be encountering this include problem.)
Instead of "..\include", try going into the property editor for that field and use the macros like $(SolutionPath)cv\include. If you examine the macros it should tell you exactly where that target will be.

How to define relative paths in Visual Studio Project?

I have a library and a console application that uses a library. The library has a folder with source and header files.
My project is in a child/inner directory but that library directory that I want to include is in a parent/upper directory.
My project directory:
H:\Gmail_04\gsasl-1.0\lib\libgsaslMain
Includes files are here:
H:\Gmail_04\gsasl-1.0\src
How can I use paths relative to the project directory, to include folders that are in a parent/upper directory?
Instead of using relative paths, you could also use the predefined macros of VS to achieve this.
$(ProjectDir) points to the directory of your .vcproj file, $(SolutionDir) is the directory of the .sln file.
You get a list of available macros when opening a project, go to
Properties → Configuration Properties → C/C++ → General
and hit the three dots:
In the upcoming dialog, hit Macros to see the macros that are predefined by the Studio (consult MSDN for their meaning):
You can use the Macros by typing $(MACRO_NAME) (note the $ and the round brackets).
If I get you right, you need ..\..\src
I have used a syntax like this before:
$(ProjectDir)..\headers
or
..\headers
As other have pointed out, the starting directory is the one your project file is in(vcproj or vcxproj), not where your main code is located.
By default, all paths you define will be relative. The question is: relative to what? There are several options:
Specifying a file or a path with nothing before it. For example: "mylib.lib". In that case, the file will be searched at the Output Directory.
If you add "..\", the path will be calculated from the actual path where the .sln file resides.
Please note that following a macro such as $(SolutionDir) there is no need to add a backward slash "\". Just use $(SolutionDir)mylibdir\mylib.lib.
In case you just can't get it to work, open the project file externally from Notepad and check it.
There are a couple of hints you need to know.
consider your app is running under c:\MyRepository\MyApp
a single dot on your path means the folder where your app runs. So if you like to reach some folder or file under MyApp folder (imagine c:\MyRepository\MyApp\Resources\someText.txt) you can do it like var bla = File.Exists(./Resources/someText.txt)
and you can go one level up with double dots (..) think about a folder under c:\MyRepository\SomeFolder\sometext.txt
for MyApp, it will be like
var bla = File.Exists(../SomeFolder/someText.txt)
and it is possible to go 2,3,4.. levels up like
../../SomeFolder (2 levels up)
../../../SomeFolder (3 levels up)
and path starting with no dots means the drive root. var bla = File.Exists(/SomeFolder/someText.txt) will look for the c:\SomeFolder\someText.txt in our scenario.

Using files in Check test cases

I need to use a file for one of my tests written using Check. I initially hardcoded the path, which worked fine. However, this didn't work when the code is built outside of the source directory. I came up with the following solution which somewhat works. (I then prefix pathnames with TESTS_DIR)
# Set correct directory for test files
AS_IF([test "x$srcdir" = x.],
[TESTS_DIR=""],
[TESTS_DIR="$srcdir/tests/"])
AC_DEFINE_UNQUOTED([TESTS_DIR], ["$TESTS_DIR"], [directory for test files])
Unfortunately, this fails again for make distcheck. I could post specific path layouts and structures, but I'm wondering if there's an "easy" way to refer to files in the source directory in all these cases. Thanks!
UPDATE: I've tried to use absolute paths, but it seems $abs_top_srcdir isn't set when I tried to update the define in configure.ac. Any thoughts as to why that is would be appreciated.
I discovered that the problem was that $top_srcdir is not set at configure time. Instead, I added -DTESTS_DIR="\"$(top_srcdir)/tests/\"" to AM_CFLAGS in my tests Makefile.am and also added all directories containing test files to EXTRA_DIST.

Resources